1
- # Copyright 2022-2023 , axodotdev
1
+ # Copyright 2022-2024 , axodotdev
2
2
# SPDX-License-Identifier: MIT or Apache-2.0
3
3
#
4
4
# CI that:
5
5
#
6
6
# * checks for a Git Tag that looks like a release
7
7
# * builds artifacts with cargo-dist (archives, installers, hashes)
8
8
# * uploads those artifacts to temporary workflow zip
9
- # * on success, uploads the artifacts to a Github Release
9
+ # * on success, uploads the artifacts to a GitHub Release
10
10
#
11
- # Note that the Github Release will be created with a generated
11
+ # Note that the GitHub Release will be created with a generated
12
12
# title/body based on your changelogs.
13
13
14
14
name : Release
@@ -31,7 +31,7 @@ permissions:
31
31
# packages versioned/released in lockstep).
32
32
#
33
33
# If you push multiple tags at once, separate instances of this workflow will
34
- # spin up, creating an independent announcement for each one. However Github
34
+ # spin up, creating an independent announcement for each one. However, GitHub
35
35
# will hard limit this to 3 tags per commit, as it will assume more tags is a
36
36
# mistake.
37
37
#
62
62
# we specify bash to get pipefail; it guards against the `curl` command
63
63
# failing. otherwise `sh` won't catch that `curl` returned non-0
64
64
shell : bash
65
- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.10.0 /cargo-dist-installer.sh | sh"
65
+ run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1 /cargo-dist-installer.sh | sh"
66
66
# sure would be cool if github gave us proper conditionals...
67
67
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
68
68
# functionality based on whether this is a pull_request, and whether it's from a fork.
@@ -105,10 +105,15 @@ jobs:
105
105
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
106
106
BUILD_MANIFEST_NAME : target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
107
107
steps :
108
+ - name : enable windows longpaths
109
+ run : |
110
+ git config --global core.longpaths true
108
111
- uses : actions/checkout@v4
109
112
with :
110
113
submodules : recursive
111
114
- uses : swatinem/rust-cache@v2
115
+ with :
116
+ key : ${{ join(matrix.targets, '-') }}
112
117
- name : Install cargo-dist
113
118
run : ${{ matrix.install_dist }}
114
119
# Get the dist-manifest
@@ -135,7 +140,7 @@ jobs:
135
140
run : |
136
141
# Parse out what we just built and upload it to scratch storage
137
142
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
138
- jq --raw-output ".artifacts[]?.path | select( . != null ) " dist-manifest.json >> "$GITHUB_OUTPUT"
143
+ jq --raw-output ".upload_files[] " dist-manifest.json >> "$GITHUB_OUTPUT"
139
144
echo "EOF" >> "$GITHUB_OUTPUT"
140
145
141
146
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -161,7 +166,8 @@ jobs:
161
166
with :
162
167
submodules : recursive
163
168
- name : Install cargo-dist
164
- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.10.0/cargo-dist-installer.sh | sh"
169
+ shell : bash
170
+ run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh"
165
171
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
166
172
- name : Fetch local artifacts
167
173
uses : actions/download-artifact@v4
@@ -177,7 +183,7 @@ jobs:
177
183
178
184
# Parse out what we just built and upload it to scratch storage
179
185
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
180
- jq --raw-output ".artifacts[]?.path | select( . != null ) " dist-manifest.json >> "$GITHUB_OUTPUT"
186
+ jq --raw-output ".upload_files[] " dist-manifest.json >> "$GITHUB_OUTPUT"
181
187
echo "EOF" >> "$GITHUB_OUTPUT"
182
188
183
189
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -206,15 +212,15 @@ jobs:
206
212
with :
207
213
submodules : recursive
208
214
- name : Install cargo-dist
209
- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.10.0 /cargo-dist-installer.sh | sh"
215
+ run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1 /cargo-dist-installer.sh | sh"
210
216
# Fetch artifacts from scratch-storage
211
217
- name : Fetch artifacts
212
218
uses : actions/download-artifact@v4
213
219
with :
214
220
pattern : artifacts-*
215
221
path : target/distrib/
216
222
merge-multiple : true
217
- # This is a harmless no-op for Github Releases, hosting for that happens in "announce"
223
+ # This is a harmless no-op for GitHub Releases, hosting for that happens in "announce"
218
224
- id : host
219
225
shell : bash
220
226
run : |
@@ -246,27 +252,30 @@ jobs:
246
252
repository : " quodlibetor/homebrew-git-tools"
247
253
token : ${{ secrets.HOMEBREW_TAP_TOKEN }}
248
254
# So we have access to the formula
249
- - name : Fetch local artifacts
255
+ - name : Fetch homebrew formulae
250
256
uses : actions/download-artifact@v4
251
257
with :
252
258
pattern : artifacts-*
253
259
path : Formula/
254
260
merge-multiple : true
261
+ # This is extra complex because you can make your Formula name not match your app name
262
+ # so we need to find releases with a *.rb file, and publish with that filename.
255
263
- name : Commit formula files
256
264
run : |
257
265
git config --global user.name "${GITHUB_USER}"
258
266
git config --global user.email "${GITHUB_EMAIL}"
259
267
260
- for release in $(echo "$PLAN" | jq --compact-output '.releases[]'); do
261
- name=$(echo "$release" | jq .app_name --raw-output)
268
+ for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do
269
+ filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output)
270
+ name=$(echo "$filename" | sed "s/\.rb$//")
262
271
version=$(echo "$release" | jq .app_version --raw-output)
263
272
264
- git add Formula/${name}.rb
273
+ git add " Formula/${filename}"
265
274
git commit -m "${name} ${version}"
266
275
done
267
276
git push
268
277
269
- # Create a Github Release while uploading all files to it
278
+ # Create a GitHub Release while uploading all files to it
270
279
announce :
271
280
needs :
272
281
- plan
@@ -283,7 +292,7 @@ jobs:
283
292
- uses : actions/checkout@v4
284
293
with :
285
294
submodules : recursive
286
- - name : " Download Github Artifacts"
295
+ - name : " Download GitHub Artifacts"
287
296
uses : actions/download-artifact@v4
288
297
with :
289
298
pattern : artifacts-*
@@ -293,7 +302,7 @@ jobs:
293
302
run : |
294
303
# Remove the granular manifests
295
304
rm -f artifacts/*-dist-manifest.json
296
- - name : Create Github Release
305
+ - name : Create GitHub Release
297
306
uses : ncipollo/release-action@v1
298
307
with :
299
308
tag : ${{ needs.plan.outputs.tag }}
0 commit comments