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.
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.16.0/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,10 +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
- cache-provider : ${{ matrix.cache_provider }}
118
120
- name : Install cargo-dist
119
121
run : ${{ matrix.install_dist }}
120
122
# Get the dist-manifest
@@ -166,9 +168,12 @@ jobs:
166
168
- uses : actions/checkout@v4
167
169
with :
168
170
submodules : recursive
169
- - name : Install cargo-dist
170
- shell : bash
171
- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.16.0/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
172
177
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
173
178
- name : Fetch local artifacts
174
179
uses : actions/download-artifact@v4
@@ -212,16 +217,19 @@ jobs:
212
217
- uses : actions/checkout@v4
213
218
with :
214
219
submodules : recursive
215
- - name : Install cargo-dist
216
- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.16.0/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
217
226
# Fetch artifacts from scratch-storage
218
227
- name : Fetch artifacts
219
228
uses : actions/download-artifact@v4
220
229
with :
221
230
pattern : artifacts-*
222
231
path : target/distrib/
223
232
merge-multiple : true
224
- # This is a harmless no-op for GitHub Releases, hosting for that happens in "announce"
225
233
- id : host
226
234
shell : bash
227
235
run : |
@@ -235,23 +243,7 @@ jobs:
235
243
# Overwrite the previous copy
236
244
name : artifacts-dist-manifest
237
245
path : dist-manifest.json
238
-
239
- # Create a GitHub Release while uploading all files to it
240
- announce :
241
- needs :
242
- - plan
243
- - host
244
- # use "always() && ..." to allow us to wait for all publish jobs while
245
- # still allowing individual publish jobs to skip themselves (for prereleases).
246
- # "host" however must run to completion, no skipping allowed!
247
- if : ${{ always() && needs.host.result == 'success' }}
248
- runs-on : " ubuntu-20.04"
249
- env :
250
- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
251
- steps :
252
- - uses : actions/checkout@v4
253
- with :
254
- submodules : recursive
246
+ # Create a GitHub Release while uploading all files to it
255
247
- name : " Download GitHub Artifacts"
256
248
uses : actions/download-artifact@v4
257
249
with :
@@ -264,12 +256,28 @@ jobs:
264
256
rm -f artifacts/*-dist-manifest.json
265
257
- name : Create GitHub Release
266
258
env :
267
- PRERELEASE_FLAG : " ${{ fromJson(needs.host.outputs.val).announcement_is_prerelease && '--prerelease' || '' }}"
268
- ANNOUNCEMENT_TITLE : " ${{ fromJson(needs.host.outputs.val).announcement_title }}"
269
- ANNOUNCEMENT_BODY : " ${{ fromJson(needs.host.outputs.val).announcement_github_body }}"
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 }}"
270
263
run : |
271
264
# Write and read notes from a file to avoid quoting breaking things
272
265
echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt
273
266
274
- gh release create "${{ needs.plan.outputs.tag }}" --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" $PRERELEASE_FLAG
275
- gh release upload "${{ needs.plan.outputs.tag }}" artifacts/*
267
+ gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
268
+
269
+ announce :
270
+ needs :
271
+ - plan
272
+ - host
273
+ # use "always() && ..." to allow us to wait for all publish jobs while
274
+ # still allowing individual publish jobs to skip themselves (for prereleases).
275
+ # "host" however must run to completion, no skipping allowed!
276
+ if : ${{ always() && needs.host.result == 'success' }}
277
+ runs-on : " ubuntu-20.04"
278
+ env :
279
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
280
+ steps :
281
+ - uses : actions/checkout@v4
282
+ with :
283
+ submodules : recursive
0 commit comments