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
- id-token : write
19
- attestations : write
18
+ " attestations " : " write"
19
+ " contents " : " write"
20
+ " id-token " : " write"
20
21
21
22
# This task will run whenever you push a git tag that looks like a version
22
23
# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc.
64
65
# we specify bash to get pipefail; it guards against the `curl` command
65
66
# failing. otherwise `sh` won't catch that `curl` returned non-0
66
67
shell : bash
67
- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.16.0/cargo-dist-installer.sh | sh"
68
+ run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.21.1/cargo-dist-installer.sh | sh"
69
+ - name : Cache cargo-dist
70
+ uses : actions/upload-artifact@v4
71
+ with :
72
+ name : cargo-dist-cache
73
+ path : ~/.cargo/bin/cargo-dist
68
74
# sure would be cool if github gave us proper conditionals...
69
75
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
70
76
# functionality based on whether this is a pull_request, and whether it's from a fork.
@@ -113,10 +119,6 @@ jobs:
113
119
- uses : actions/checkout@v4
114
120
with :
115
121
submodules : recursive
116
- - uses : swatinem/rust-cache@v2
117
- with :
118
- key : ${{ join(matrix.targets, '-') }}
119
- cache-provider : ${{ matrix.cache_provider }}
120
122
- name : Install cargo-dist
121
123
run : ${{ matrix.install_dist }}
122
124
# Get the dist-manifest
@@ -172,9 +174,12 @@ jobs:
172
174
- uses : actions/checkout@v4
173
175
with :
174
176
submodules : recursive
175
- - name : Install cargo-dist
176
- shell : bash
177
- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.16.0/cargo-dist-installer.sh | sh"
177
+ - name : Install cached cargo-dist
178
+ uses : actions/download-artifact@v4
179
+ with :
180
+ name : cargo-dist-cache
181
+ path : ~/.cargo/bin/
182
+ - run : chmod +x ~/.cargo/bin/cargo-dist
178
183
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
179
184
- name : Fetch local artifacts
180
185
uses : actions/download-artifact@v4
@@ -218,16 +223,19 @@ jobs:
218
223
- uses : actions/checkout@v4
219
224
with :
220
225
submodules : recursive
221
- - name : Install cargo-dist
222
- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.16.0/cargo-dist-installer.sh | sh"
226
+ - name : Install cached cargo-dist
227
+ uses : actions/download-artifact@v4
228
+ with :
229
+ name : cargo-dist-cache
230
+ path : ~/.cargo/bin/
231
+ - run : chmod +x ~/.cargo/bin/cargo-dist
223
232
# Fetch artifacts from scratch-storage
224
233
- name : Fetch artifacts
225
234
uses : actions/download-artifact@v4
226
235
with :
227
236
pattern : artifacts-*
228
237
path : target/distrib/
229
238
merge-multiple : true
230
- # This is a harmless no-op for GitHub Releases, hosting for that happens in "announce"
231
239
- id : host
232
240
shell : bash
233
241
run : |
@@ -241,23 +249,7 @@ jobs:
241
249
# Overwrite the previous copy
242
250
name : artifacts-dist-manifest
243
251
path : dist-manifest.json
244
-
245
- # Create a GitHub Release while uploading all files to it
246
- announce :
247
- needs :
248
- - plan
249
- - host
250
- # use "always() && ..." to allow us to wait for all publish jobs while
251
- # still allowing individual publish jobs to skip themselves (for prereleases).
252
- # "host" however must run to completion, no skipping allowed!
253
- if : ${{ always() && needs.host.result == 'success' }}
254
- runs-on : " ubuntu-20.04"
255
- env :
256
- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
257
- steps :
258
- - uses : actions/checkout@v4
259
- with :
260
- submodules : recursive
252
+ # Create a GitHub Release while uploading all files to it
261
253
- name : " Download GitHub Artifacts"
262
254
uses : actions/download-artifact@v4
263
255
with :
@@ -270,12 +262,28 @@ jobs:
270
262
rm -f artifacts/*-dist-manifest.json
271
263
- name : Create GitHub Release
272
264
env :
273
- PRERELEASE_FLAG : " ${{ fromJson(needs.host.outputs.val).announcement_is_prerelease && '--prerelease' || '' }}"
274
- ANNOUNCEMENT_TITLE : " ${{ fromJson(needs.host.outputs.val).announcement_title }}"
275
- ANNOUNCEMENT_BODY : " ${{ fromJson(needs.host.outputs.val).announcement_github_body }}"
265
+ PRERELEASE_FLAG : " ${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}"
266
+ ANNOUNCEMENT_TITLE : " ${{ fromJson(steps.host.outputs.manifest).announcement_title }}"
267
+ ANNOUNCEMENT_BODY : " ${{ fromJson(steps.host.outputs.manifest).announcement_github_body }}"
268
+ RELEASE_COMMIT : " ${{ github.sha }}"
276
269
run : |
277
270
# Write and read notes from a file to avoid quoting breaking things
278
271
echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt
279
272
280
- gh release create "${{ needs.plan.outputs.tag }}" --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" $PRERELEASE_FLAG
281
- gh release upload "${{ needs.plan.outputs.tag }}" artifacts/*
273
+ gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
274
+
275
+ announce :
276
+ needs :
277
+ - plan
278
+ - host
279
+ # use "always() && ..." to allow us to wait for all publish jobs while
280
+ # still allowing individual publish jobs to skip themselves (for prereleases).
281
+ # "host" however must run to completion, no skipping allowed!
282
+ if : ${{ always() && needs.host.result == 'success' }}
283
+ runs-on : " ubuntu-20.04"
284
+ env :
285
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
286
+ steps :
287
+ - uses : actions/checkout@v4
288
+ with :
289
+ submodules : recursive
0 commit comments