12
12
# title/body based on your changelogs.
13
13
14
14
name : Release
15
-
16
15
permissions :
17
- contents : write
16
+ " contents " : " write"
18
17
19
18
# This task will run whenever you push a git tag that looks like a version
20
19
# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc.
62
61
# we specify bash to get pipefail; it guards against the `curl` command
63
62
# failing. otherwise `sh` won't catch that `curl` returned non-0
64
63
shell : bash
65
- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.15.1/cargo-dist-installer.sh | sh"
64
+ run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.20.0/cargo-dist-installer.sh | sh"
65
+ - name : Cache cargo-dist
66
+ uses : actions/upload-artifact@v4
67
+ with :
68
+ name : cargo-dist-cache
69
+ path : ~/.cargo/bin/cargo-dist
66
70
# sure would be cool if github gave us proper conditionals...
67
71
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
68
72
# functionality based on whether this is a pull_request, and whether it's from a fork.
@@ -111,9 +115,6 @@ jobs:
111
115
- uses : actions/checkout@v4
112
116
with :
113
117
submodules : recursive
114
- - uses : swatinem/rust-cache@v2
115
- with :
116
- key : ${{ join(matrix.targets, '-') }}
117
118
- name : Install cargo-dist
118
119
run : ${{ matrix.install_dist }}
119
120
# Get the dist-manifest
@@ -165,9 +166,12 @@ jobs:
165
166
- uses : actions/checkout@v4
166
167
with :
167
168
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.15.1/cargo-dist-installer.sh | sh"
169
+ - name : Install cached cargo-dist
170
+ uses : actions/download-artifact@v4
171
+ with :
172
+ name : cargo-dist-cache
173
+ path : ~/.cargo/bin/
174
+ - run : chmod +x ~/.cargo/bin/cargo-dist
171
175
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
172
176
- name : Fetch local artifacts
173
177
uses : actions/download-artifact@v4
@@ -211,16 +215,19 @@ jobs:
211
215
- uses : actions/checkout@v4
212
216
with :
213
217
submodules : recursive
214
- - name : Install cargo-dist
215
- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.15.1/cargo-dist-installer.sh | sh"
218
+ - name : Install cached cargo-dist
219
+ uses : actions/download-artifact@v4
220
+ with :
221
+ name : cargo-dist-cache
222
+ path : ~/.cargo/bin/
223
+ - run : chmod +x ~/.cargo/bin/cargo-dist
216
224
# Fetch artifacts from scratch-storage
217
225
- name : Fetch artifacts
218
226
uses : actions/download-artifact@v4
219
227
with :
220
228
pattern : artifacts-*
221
229
path : target/distrib/
222
230
merge-multiple : true
223
- # This is a harmless no-op for GitHub Releases, hosting for that happens in "announce"
224
231
- id : host
225
232
shell : bash
226
233
run : |
@@ -234,8 +241,29 @@ jobs:
234
241
# Overwrite the previous copy
235
242
name : artifacts-dist-manifest
236
243
path : dist-manifest.json
244
+ # Create a GitHub Release while uploading all files to it
245
+ - name : " Download GitHub Artifacts"
246
+ uses : actions/download-artifact@v4
247
+ with :
248
+ pattern : artifacts-*
249
+ path : artifacts
250
+ merge-multiple : true
251
+ - name : Cleanup
252
+ run : |
253
+ # Remove the granular manifests
254
+ rm -f artifacts/*-dist-manifest.json
255
+ - name : Create GitHub Release
256
+ env :
257
+ PRERELEASE_FLAG : " ${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}"
258
+ ANNOUNCEMENT_TITLE : " ${{ fromJson(steps.host.outputs.manifest).announcement_title }}"
259
+ ANNOUNCEMENT_BODY : " ${{ fromJson(steps.host.outputs.manifest).announcement_github_body }}"
260
+ RELEASE_COMMIT : " ${{ github.sha }}"
261
+ run : |
262
+ # Write and read notes from a file to avoid quoting breaking things
263
+ echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt
264
+
265
+ gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
237
266
238
- # Create a GitHub Release while uploading all files to it
239
267
announce :
240
268
needs :
241
269
- plan
@@ -251,21 +279,3 @@ jobs:
251
279
- uses : actions/checkout@v4
252
280
with :
253
281
submodules : recursive
254
- - name : " Download GitHub Artifacts"
255
- uses : actions/download-artifact@v4
256
- with :
257
- pattern : artifacts-*
258
- path : artifacts
259
- merge-multiple : true
260
- - name : Cleanup
261
- run : |
262
- # Remove the granular manifests
263
- rm -f artifacts/*-dist-manifest.json
264
- - name : Create GitHub Release
265
- uses : ncipollo/release-action@v1
266
- with :
267
- tag : ${{ needs.plan.outputs.tag }}
268
- name : ${{ fromJson(needs.host.outputs.val).announcement_title }}
269
- body : ${{ fromJson(needs.host.outputs.val).announcement_github_body }}
270
- prerelease : ${{ fromJson(needs.host.outputs.val).announcement_is_prerelease }}
271
- artifacts : " artifacts/*"
0 commit comments