1
1
# GitHub release workflow.
2
- #
3
- # This workflow is a bit complicated because we have to build darwin binaries on
4
- # a mac runner, but the mac runners are extremely slow. So instead of running
5
- # the entire release on a mac (which will take an hour to run), we run only the
6
- # mac build on a mac, and the rest on a linux runner. The final release is then
7
- # published using a final linux runner.
8
2
name : release
9
3
on :
10
4
push :
31
25
CODER_RELEASE : ${{ github.event.inputs.snapshot && 'false' || 'true' }}
32
26
33
27
jobs :
34
- linux-windows :
28
+ release :
35
29
runs-on : ubuntu-latest
36
30
env :
37
31
# Necessary for Docker manifest
@@ -72,21 +66,58 @@ jobs:
72
66
js-${{ runner.os }}-
73
67
74
68
- name : Install nfpm
75
- run : go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.16.0
69
+ run : |
70
+ set -euo pipefail
71
+ wget -O /tmp/nfpm.deb https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.deb
72
+ sudo dpkg -i /tmp/nfpm.deb
76
73
- name : Install zstd
77
74
run : sudo apt-get install -y zstd
78
75
79
- - name : Build Linux and Windows Binaries
76
+ - name : Install rcodesign
77
+ run : |
78
+ set -euo pipefail
79
+
80
+ # Install a prebuilt binary of rcodesign for linux amd64. Once the
81
+ # following PR is merged and released upstream, we can download
82
+ # directly from GitHub releases instead:
83
+ # https://github.com/indygreg/PyOxidizer/pull/635
84
+ wget -O /tmp/rcodesign https://cdn.discordapp.com/attachments/283356472258199552/1016767245717872700/rcodesign
85
+ sudo install --mode 755 /tmp/rcodesign /usr/local/bin/rcodesign
86
+
87
+ - name : Setup Apple Developer certificate and API key
88
+ run : |
89
+ set -euo pipefail
90
+ touch /tmp/{apple_cert.p12,apple_cert_password.txt,apple_apikey.p8}
91
+ chmod 600 /tmp/{apple_cert.p12,apple_cert_password.txt,apple_apikey.p8}
92
+ echo "$AC_CERTIFICATE_P12_BASE64" | base64 -d > /tmp/apple_cert.p12
93
+ echo "$AC_CERTIFICATE_PASSWORD" > /tmp/apple_cert_password.txt
94
+ echo "$AC_APIKEY_P8_BASE64" | base64 -d > /tmp/apple_apikey.p8
95
+ env :
96
+ AC_CERTIFICATE_P12_BASE64 : ${{ secrets.AC_CERTIFICATE_P12_BASE64 }}
97
+ AC_CERTIFICATE_PASSWORD : ${{ secrets.AC_CERTIFICATE_PASSWORD }}
98
+ AC_APIKEY_P8_BASE64 : ${{ secrets.AC_APIKEY_P8_BASE64 }}
99
+
100
+ - name : Build binaries
80
101
run : |
81
102
set -euo pipefail
82
103
go mod download
83
104
84
105
version="$(./scripts/version.sh)"
85
106
make gen/mark-fresh
86
107
make -j \
87
- -W coderd/database/querier.go \
88
- build/coder_"$version"_linux_{amd64,arm64,armv7}.{tar.gz,apk,deb,rpm} \
89
- build/coder_"$version"_windows_{amd64,arm64}.zip \
108
+ build/coder_"$version"_linux_{amd64,armv7,arm64}.{tar.gz,apk,deb,rpm} \
109
+ build/coder_"$version"_{darwin,windows}_{amd64,arm64}.zip \
110
+ build/coder_helm_"$version".tgz
111
+ env :
112
+ CODER_SIGN_DARWIN : " 1"
113
+ AC_CERTIFICATE_FILE : /tmp/apple_cert.p12
114
+ AC_CERTIFICATE_PASSWORD_FILE : /tmp/apple_cert_password.txt
115
+ AC_APIKEY_ISSUER_ID : ${{ secrets.AC_APIKEY_ISSUER_ID }}
116
+ AC_APIKEY_ID : ${{ secrets.AC_APIKEY_ID }}
117
+ AC_APIKEY_FILE : /tmp/apple_apikey.p8
118
+
119
+ - name : Delete Apple Developer certificate and API key
120
+ run : rm -f /tmp/{apple_cert.p12,apple_cert_password.txt,apple_apikey.p8}
90
121
91
122
- name : Build Linux Docker images
92
123
run : |
@@ -112,157 +143,37 @@ jobs:
112
143
# push it
113
144
if [[ "$(git tag | grep '^v' | grep -vE '(rc|dev|-|\+|\/)' | sort -r --version-sort | head -n1)" == "v$(./scripts/version.sh)" ]]; then
114
145
./scripts/build_docker_multiarch.sh \
115
- --target "$(./scripts/image_tag.sh --version latest)" \
116
146
--push \
147
+ --target "$(./scripts/image_tag.sh --version latest)" \
117
148
$(cat build/coder_"$version"_linux_{amd64,arm64,armv7}.tag)
118
149
fi
119
150
120
- - name : Upload binary artifacts
121
- uses : actions/upload-artifact@v3
151
+ - name : ls build
152
+ run : ls -lh build
153
+
154
+ - name : Publish release
155
+ run : |
156
+ ./scripts/publish_release.sh \
157
+ ${{ (github.event.inputs.dry_run || github.event.inputs.snapshot) && '--dry-run' }} \
158
+ ./build/*.zip \
159
+ ./build/*.tar.gz \
160
+ ./build/*.tgz \
161
+ ./build/*.apk \
162
+ ./build/*.deb \
163
+ ./build/*.rpm
164
+ env :
165
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
166
+
167
+ - name : Upload artifacts to actions (if dry-run or snapshot)
168
+ if : ${{ github.event.inputs.dry_run || github.event.inputs.snapshot }}
169
+ uses : actions/upload-artifact@v2
122
170
with :
123
- name : linux
171
+ name : release-artifacts
124
172
path : |
125
173
./build/*.zip
126
174
./build/*.tar.gz
175
+ ./build/*.tgz
127
176
./build/*.apk
128
177
./build/*.deb
129
178
./build/*.rpm
130
-
131
- # The mac binaries get built on mac runners because they need to be signed,
132
- # and the signing tool only runs on mac. This darwin job only builds the Mac
133
- # binaries and uploads them as job artifacts used by the publish step.
134
- darwin :
135
- runs-on : macos-latest
136
- steps :
137
- - uses : actions/checkout@v3
138
- with :
139
- fetch-depth : 0
140
-
141
- # If the event that triggered the build was an annotated tag (which our
142
- # tags are supposed to be), actions/checkout has a bug where the tag in
143
- # question is only a lightweight tag and not a full annotated tag. This
144
- # command seems to fix it.
145
- # https://github.com/actions/checkout/issues/290
146
- - name : Fetch git tags
147
- run : git fetch --tags --force
148
-
149
- - uses : actions/setup-go@v3
150
- with :
151
- go-version : " ~1.19"
152
-
153
- - name : Import Signing Certificates
154
- uses : Apple-Actions/import-codesign-certs@v1
155
- with :
156
- p12-file-base64 : ${{ secrets.AC_CERTIFICATE_P12_BASE64 }}
157
- p12-password : ${{ secrets.AC_CERTIFICATE_PASSWORD }}
158
-
159
- - name : Cache Node
160
- id : cache-node
161
- uses : actions/cache@v3
162
- with :
163
- path : |
164
- **/node_modules
165
- .eslintcache
166
- key : js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
167
- restore-keys : |
168
- js-${{ runner.os }}-
169
-
170
- - name : Install dependencies
171
- run : |
172
- set -euo pipefail
173
- # The version of bash that macOS ships with is too old
174
- brew install bash
175
-
176
- # The version of make that macOS ships with is too old
177
- brew install make
178
- echo "$(brew --prefix)/opt/make/libexec/gnubin" >> $GITHUB_PATH
179
-
180
- # BSD getopt is incompatible with the build scripts
181
- brew install gnu-getopt
182
- echo "$(brew --prefix)/opt/gnu-getopt/bin" >> $GITHUB_PATH
183
-
184
- # Used for notarizing the binaries
185
- brew tap mitchellh/gon
186
- brew install mitchellh/gon/gon
187
-
188
- # Used for compressing embedded slim binaries
189
- brew install zstd
190
-
191
- - name : Build darwin Binaries (with signatures)
192
- run : |
193
- set -euo pipefail
194
- go mod download
195
-
196
- version="$(./scripts/version.sh)"
197
- make gen/mark-fresh
198
- make -j \
199
- build/coder_"$version"_darwin_{amd64,arm64}.zip
200
- env :
201
- CODER_SIGN_DARWIN : " 1"
202
- AC_USERNAME : ${{ secrets.AC_USERNAME }}
203
- AC_PASSWORD : ${{ secrets.AC_PASSWORD }}
204
- AC_APPLICATION_IDENTITY : BDB050EB749EDD6A80C6F119BF1382ECA119CCCC
205
-
206
- - name : Upload Binary Artifacts
207
- uses : actions/upload-artifact@v3
208
- with :
209
- name : darwin
210
- path : ./build/*.zip
211
-
212
- publish :
213
- runs-on : ubuntu-latest
214
- needs :
215
- - linux-windows
216
- - darwin
217
- steps :
218
- - uses : actions/checkout@v3
219
- with :
220
- fetch-depth : 0
221
-
222
- # If the event that triggered the build was an annotated tag (which our
223
- # tags are supposed to be), actions/checkout has a bug where the tag in
224
- # question is only a lightweight tag and not a full annotated tag. This
225
- # command seems to fix it.
226
- # https://github.com/actions/checkout/issues/290
227
- - name : Fetch git tags
228
- run : git fetch --tags --force
229
-
230
- - name : mkdir artifacts
231
- run : mkdir artifacts
232
-
233
- - name : Download darwin Artifacts
234
- uses : actions/download-artifact@v3
235
- with :
236
- name : darwin
237
- path : artifacts
238
-
239
- - name : Download Linux and Windows Artifacts
240
- uses : actions/download-artifact@v3
241
- with :
242
- name : linux
243
- path : artifacts
244
-
245
- - name : ls artifacts
246
- run : ls artifacts
247
-
248
- - name : Publish Helm
249
- run : |
250
- set -euxo pipefail
251
-
252
- version="$(./scripts/version.sh)"
253
- make -j \
254
- build/coder_helm_"$version".tgz
255
- mv ./build/*.tgz ./artifacts/
256
-
257
- - name : Publish Release
258
- run : |
259
- ./scripts/publish_release.sh \
260
- ${{ (github.event.inputs.dry_run || github.event.inputs.snapshot) && '--dry-run' }} \
261
- ./artifacts/*.zip \
262
- ./artifacts/*.tar.gz \
263
- ./artifacts/*.tgz \
264
- ./artifacts/*.apk \
265
- ./artifacts/*.deb \
266
- ./artifacts/*.rpm
267
- env :
268
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
179
+ retention-days : 7
0 commit comments