1
+ # This file was autogenerated by cargo-dist: https://opensource.axo.dev/cargo-dist/
2
+ #
1
3
# Copyright 2022-2024, axodotdev
2
4
# SPDX-License-Identifier: MIT or Apache-2.0
3
5
#
12
14
# title/body based on your changelogs.
13
15
14
16
name : Release
15
-
16
17
permissions :
17
- contents : write
18
+ " contents " : " write"
18
19
19
20
# This task will run whenever you push a git tag that looks like a version
20
21
# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc.
@@ -38,15 +39,15 @@ permissions:
38
39
# If there's a prerelease-style suffix to the version, then the release(s)
39
40
# will be marked as a prerelease.
40
41
on :
42
+ pull_request :
41
43
push :
42
44
tags :
43
45
- ' **[0-9]+.[0-9]+.[0-9]+*'
44
- pull_request :
45
46
46
47
jobs :
47
48
# Run 'cargo dist plan' (or host) to determine what tasks we need to do
48
49
plan :
49
- runs-on : ubuntu-latest
50
+ runs-on : " ubuntu-20.04 "
50
51
outputs :
51
52
val : ${{ steps.plan.outputs.manifest }}
52
53
tag : ${{ !github.event.pull_request && github.ref_name || '' }}
62
63
# we specify bash to get pipefail; it guards against the `curl` command
63
64
# failing. otherwise `sh` won't catch that `curl` returned non-0
64
65
shell : bash
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
+ run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.22.1/cargo-dist-installer.sh | sh"
67
+ - name : Cache cargo-dist
68
+ uses : actions/upload-artifact@v4
69
+ with :
70
+ name : cargo-dist-cache
71
+ path : ~/.cargo/bin/cargo-dist
66
72
# sure would be cool if github gave us proper conditionals...
67
73
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
68
74
# functionality based on whether this is a pull_request, and whether it's from a fork.
@@ -111,9 +117,6 @@ jobs:
111
117
- uses : actions/checkout@v4
112
118
with :
113
119
submodules : recursive
114
- - uses : swatinem/rust-cache@v2
115
- with :
116
- key : ${{ join(matrix.targets, '-') }}
117
120
- name : Install cargo-dist
118
121
run : ${{ matrix.install_dist }}
119
122
# Get the dist-manifest
@@ -165,9 +168,12 @@ jobs:
165
168
- uses : actions/checkout@v4
166
169
with :
167
170
submodules : recursive
168
- - name : Install cargo-dist
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"
171
+ - name : Install cached cargo-dist
172
+ uses : actions/download-artifact@v4
173
+ with :
174
+ name : cargo-dist-cache
175
+ path : ~/.cargo/bin/
176
+ - run : chmod +x ~/.cargo/bin/cargo-dist
171
177
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
172
178
- name : Fetch local artifacts
173
179
uses : actions/download-artifact@v4
@@ -211,16 +217,19 @@ jobs:
211
217
- uses : actions/checkout@v4
212
218
with :
213
219
submodules : recursive
214
- - name : Install cargo-dist
215
- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh"
220
+ - name : Install cached cargo-dist
221
+ uses : actions/download-artifact@v4
222
+ with :
223
+ name : cargo-dist-cache
224
+ path : ~/.cargo/bin/
225
+ - run : chmod +x ~/.cargo/bin/cargo-dist
216
226
# Fetch artifacts from scratch-storage
217
227
- name : Fetch artifacts
218
228
uses : actions/download-artifact@v4
219
229
with :
220
230
pattern : artifacts-*
221
231
path : target/distrib/
222
232
merge-multiple : true
223
- # This is a harmless no-op for GitHub Releases, hosting for that happens in "announce"
224
233
- id : host
225
234
shell : bash
226
235
run : |
@@ -234,6 +243,28 @@ jobs:
234
243
# Overwrite the previous copy
235
244
name : artifacts-dist-manifest
236
245
path : dist-manifest.json
246
+ # Create a GitHub Release while uploading all files to it
247
+ - name : " Download GitHub Artifacts"
248
+ uses : actions/download-artifact@v4
249
+ with :
250
+ pattern : artifacts-*
251
+ path : artifacts
252
+ merge-multiple : true
253
+ - name : Cleanup
254
+ run : |
255
+ # Remove the granular manifests
256
+ rm -f artifacts/*-dist-manifest.json
257
+ - name : Create GitHub Release
258
+ env :
259
+ PRERELEASE_FLAG : " ${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}"
260
+ ANNOUNCEMENT_TITLE : " ${{ fromJson(steps.host.outputs.manifest).announcement_title }}"
261
+ ANNOUNCEMENT_BODY : " ${{ fromJson(steps.host.outputs.manifest).announcement_github_body }}"
262
+ RELEASE_COMMIT : " ${{ github.sha }}"
263
+ run : |
264
+ # Write and read notes from a file to avoid quoting breaking things
265
+ echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt
266
+
267
+ gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
237
268
238
269
publish-homebrew-formula :
239
270
needs :
@@ -270,12 +301,16 @@ jobs:
270
301
name=$(echo "$filename" | sed "s/\.rb$//")
271
302
version=$(echo "$release" | jq .app_version --raw-output)
272
303
304
+ export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
305
+ brew update
306
+ # We avoid reformatting user-provided data such as the app description and homepage.
307
+ brew style --except-cops FormulaAudit/Homepage,FormulaAudit/Desc,FormulaAuditStrict --fix "Formula/${filename}" || true
308
+
273
309
git add "Formula/${filename}"
274
310
git commit -m "${name} ${version}"
275
311
done
276
312
git push
277
313
278
- # Create a GitHub Release while uploading all files to it
279
314
announce :
280
315
needs :
281
316
- plan
@@ -292,21 +327,3 @@ jobs:
292
327
- uses : actions/checkout@v4
293
328
with :
294
329
submodules : recursive
295
- - name : " Download GitHub Artifacts"
296
- uses : actions/download-artifact@v4
297
- with :
298
- pattern : artifacts-*
299
- path : artifacts
300
- merge-multiple : true
301
- - name : Cleanup
302
- run : |
303
- # Remove the granular manifests
304
- rm -f artifacts/*-dist-manifest.json
305
- - name : Create GitHub Release
306
- uses : ncipollo/release-action@v1
307
- with :
308
- tag : ${{ needs.plan.outputs.tag }}
309
- name : ${{ fromJson(needs.host.outputs.val).announcement_title }}
310
- body : ${{ fromJson(needs.host.outputs.val).announcement_github_body }}
311
- prerelease : ${{ fromJson(needs.host.outputs.val).announcement_is_prerelease }}
312
- artifacts : " artifacts/*"
0 commit comments