@@ -15,6 +15,8 @@ name: Release
15
15
16
16
permissions :
17
17
contents : write
18
+ id-token : write
19
+ attestations : write
18
20
19
21
# This task will run whenever you push a git tag that looks like a version
20
22
# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc.
@@ -38,15 +40,15 @@ permissions:
38
40
# If there's a prerelease-style suffix to the version, then the release(s)
39
41
# will be marked as a prerelease.
40
42
on :
43
+ pull_request :
41
44
push :
42
45
tags :
43
46
- ' **[0-9]+.[0-9]+.[0-9]+*'
44
- pull_request :
45
47
46
48
jobs :
47
49
# Run 'cargo dist plan' (or host) to determine what tasks we need to do
48
50
plan :
49
- runs-on : ubuntu-latest
51
+ runs-on : " ubuntu-20.04 "
50
52
outputs :
51
53
val : ${{ steps.plan.outputs.manifest }}
52
54
tag : ${{ !github.event.pull_request && github.ref_name || '' }}
62
64
# we specify bash to get pipefail; it guards against the `curl` command
63
65
# failing. otherwise `sh` won't catch that `curl` returned non-0
64
66
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"
67
+ run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.16.0 /cargo-dist-installer.sh | sh"
66
68
# sure would be cool if github gave us proper conditionals...
67
69
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
68
70
# functionality based on whether this is a pull_request, and whether it's from a fork.
@@ -114,6 +116,7 @@ jobs:
114
116
- uses : swatinem/rust-cache@v2
115
117
with :
116
118
key : ${{ join(matrix.targets, '-') }}
119
+ cache-provider : ${{ matrix.cache_provider }}
117
120
- name : Install cargo-dist
118
121
run : ${{ matrix.install_dist }}
119
122
# Get the dist-manifest
@@ -131,6 +134,10 @@ jobs:
131
134
# Actually do builds and make zips and whatnot
132
135
cargo dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
133
136
echo "cargo dist ran successfully"
137
+ - name : Attest
138
+ uses : actions/attest-build-provenance@v1
139
+ with :
140
+ subject-path : " target/distrib/*${{ join(matrix.targets, ', ') }}*"
134
141
- id : cargo-dist
135
142
name : Post-build
136
143
# We force bash here just because github makes it really hard to get values up
@@ -167,7 +174,7 @@ jobs:
167
174
submodules : recursive
168
175
- name : Install cargo-dist
169
176
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"
177
+ run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.16.0 /cargo-dist-installer.sh | sh"
171
178
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
172
179
- name : Fetch local artifacts
173
180
uses : actions/download-artifact@v4
@@ -212,7 +219,7 @@ jobs:
212
219
with :
213
220
submodules : recursive
214
221
- 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"
222
+ run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.16.0 /cargo-dist-installer.sh | sh"
216
223
# Fetch artifacts from scratch-storage
217
224
- name : Fetch artifacts
218
225
uses : actions/download-artifact@v4
@@ -303,10 +310,13 @@ jobs:
303
310
# Remove the granular manifests
304
311
rm -f artifacts/*-dist-manifest.json
305
312
- 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/*"
313
+ env :
314
+ PRERELEASE_FLAG : " ${{ fromJson(needs.host.outputs.val).announcement_is_prerelease && '--prerelease' || '' }}"
315
+ ANNOUNCEMENT_TITLE : " ${{ fromJson(needs.host.outputs.val).announcement_title }}"
316
+ ANNOUNCEMENT_BODY : " ${{ fromJson(needs.host.outputs.val).announcement_github_body }}"
317
+ run : |
318
+ # Write and read notes from a file to avoid quoting breaking things
319
+ echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt
320
+
321
+ gh release create "${{ needs.plan.outputs.tag }}" --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" $PRERELEASE_FLAG
322
+ gh release upload "${{ needs.plan.outputs.tag }}" artifacts/*
0 commit comments