@@ -4,12 +4,12 @@ set -euo pipefail
4
4
usage () {
5
5
echo " Usage: $0 [--version <version>] [--assignee <github handle>]"
6
6
echo " --version <version> Set the VERSION variable to fetch and generate the cask file for"
7
- echo " --assignee <github handle> Set the ASSIGNE variable to assign the PR to (optional)"
7
+ echo " --assignee <github handle> Set the ASSIGNEE variable to assign the PR to (optional)"
8
8
echo " -h, --help Display this help message"
9
9
}
10
10
11
11
VERSION=" "
12
- ASSIGNE =" "
12
+ ASSIGNEE =" "
13
13
14
14
# Parse command line arguments
15
15
while [[ " $# " -gt 0 ]]; do
@@ -19,7 +19,7 @@ while [[ "$#" -gt 0 ]]; do
19
19
shift 2
20
20
;;
21
21
--assignee)
22
- ASSIGNE =" $2 "
22
+ ASSIGNEE =" $2 "
23
23
shift 2
24
24
;;
25
25
-h | --help)
39
39
echo " Error: VERSION cannot be empty"
40
40
exit 1
41
41
}
42
- [[ " $VERSION " =~ ^v || " $VERSION " == " preview " ]] || {
42
+ [[ " $VERSION " =~ ^v ]] || {
43
43
echo " Error: VERSION must start with a 'v'"
44
44
exit 1
45
45
}
@@ -54,55 +54,39 @@ gh release download "$VERSION" \
54
54
55
55
HASH=$( shasum -a 256 " $GH_RELEASE_FOLDER " /Coder-Desktop.pkg | awk ' {print $1}' | tr -d ' \n' )
56
56
57
- IS_PREVIEW=false
58
- if [[ " $VERSION " == " preview" ]]; then
59
- IS_PREVIEW=true
60
- VERSION=$( make ' print-CURRENT_PROJECT_VERSION' | sed ' s/CURRENT_PROJECT_VERSION=//g' )
61
- fi
62
-
63
57
# Check out the homebrew tap repo
64
- TAP_CHECHOUT_FOLDER =$( mktemp -d)
58
+ TAP_CHECKOUT_FOLDER =$( mktemp -d)
65
59
66
- gh repo clone " coder/homebrew-coder" " $TAP_CHECHOUT_FOLDER "
60
+ gh repo clone " coder/homebrew-coder" " $TAP_CHECKOUT_FOLDER "
67
61
68
- cd " $TAP_CHECHOUT_FOLDER "
62
+ cd " $TAP_CHECKOUT_FOLDER "
69
63
70
64
BREW_BRANCH=" auto-release/desktop-$VERSION "
71
65
72
66
# Check if a PR already exists.
73
67
# Continue on a main branch release, as the sha256 will change.
74
68
pr_count=" $( gh pr list --search " head:$BREW_BRANCH " --json id,closed | jq -r " .[] | select(.closed == false) | .id" | wc -l) "
75
- if [[ " $pr_count " -gt 0 && " $IS_PREVIEW " == false ]]; then
69
+ if [[ " $pr_count " -gt 0 ]]; then
76
70
echo " Bailing out as PR already exists" 2>&1
77
71
exit 0
78
72
fi
79
73
80
74
git checkout -b " $BREW_BRANCH "
81
75
82
- # If this is a main branch build, append a preview suffix to the cask.
83
- SUFFIX=" "
84
- CONFLICTS_WITH=" coder-desktop-preview"
85
- TAG=$VERSION
86
- if [[ " $IS_PREVIEW " == true ]]; then
87
- SUFFIX=" -preview"
88
- CONFLICTS_WITH=" coder-desktop"
89
- TAG=" preview"
90
- fi
91
-
92
- mkdir -p " $TAP_CHECHOUT_FOLDER " /Casks
76
+ mkdir -p " $TAP_CHECKOUT_FOLDER " /Casks
93
77
94
78
# Overwrite the cask file
95
- cat > " $TAP_CHECHOUT_FOLDER " /Casks/coder-desktop${SUFFIX} .rb << EOF
96
- cask "coder-desktop${SUFFIX} " do
79
+ cat > " $TAP_CHECKOUT_FOLDER " /Casks/coder-desktop.rb << EOF
80
+ cask "coder-desktop" do
97
81
version "${VERSION# v} "
98
- sha256 $( [ " $IS_PREVIEW " = true ] && echo " :no_check " || echo " \" $ {HASH}\" " )
82
+ sha256 " $ {HASH}"
99
83
100
- url "https://github.com/coder/coder-desktop-macos/releases/download/$( [ " $IS_PREVIEW " = true ] && echo " ${TAG} " || echo " v#{version}" ) /Coder-Desktop.pkg"
84
+ url "https://github.com/coder/coder-desktop-macos/releases/download/v#{version}/Coder-Desktop.pkg"
101
85
name "Coder Desktop"
102
86
desc "Native desktop client for Coder"
103
87
homepage "https://github.com/coder/coder-desktop-macos"
88
+ auto_updates true
104
89
105
- conflicts_with cask: "coder/coder/${CONFLICTS_WITH} "
106
90
depends_on macos: ">= :sonoma"
107
91
108
92
pkg "Coder-Desktop.pkg"
@@ -132,5 +116,5 @@ if [[ "$pr_count" -eq 0 ]]; then
132
116
--base master --head " $BREW_BRANCH " \
133
117
--title " Coder Desktop $VERSION " \
134
118
--body " This automatic PR was triggered by the release of Coder Desktop $VERSION " \
135
- ${ASSIGNE : + --assignee " $ASSIGNE " --reviewer " $ASSIGNE " }
119
+ ${ASSIGNEE : + --assignee " $ASSIGNEE " --reviewer " $ASSIGNEE " }
136
120
fi
0 commit comments