1212# with the appropriate title/body, and will be undrafted for you.
1313
1414name : Release
15-
1615permissions :
1716 contents : read
1817
7675 # we specify bash to get pipefail; it guards against the `curl` command
7776 # failing. otherwise `sh` won't catch that `curl` returned non-0
7877 shell : bash
79- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.16.0/cargo-dist-installer.sh | sh"
78+ run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.21.0/cargo-dist-installer.sh | sh"
79+ - name : Cache cargo-dist
80+ uses : actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
81+ with :
82+ name : cargo-dist-cache
83+ path : ~/.cargo/bin/cargo-dist
8084 # sure would be cool if github gave us proper conditionals...
8185 # so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
8286 # functionality based on whether this is a pull_request, and whether it's from a fork.
@@ -133,21 +137,21 @@ jobs:
133137 - uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
134138 with :
135139 submodules : recursive
136- - uses : Swatinem /rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
140+ - uses : swatinem /rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
137141 with :
138142 key : ${{ join(matrix.targets, '-') }}
139143 cache-provider : ${{ matrix.cache_provider }}
140144 - name : Install cargo-dist
141145 run : ${{ matrix.install_dist }}
142- - name : Install cargo-auditable
143- run : cargo install cargo-auditable
144146 # Get the dist-manifest
145147 - name : Fetch local artifacts
146148 uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
147149 with :
148150 pattern : artifacts-*
149151 path : target/distrib/
150152 merge-multiple : true
153+ - name : " Install cargo-auditable"
154+ run : " cargo install cargo-auditable"
151155 - name : Install dependencies
152156 run : |
153157 ${{ matrix.packages_install }}
@@ -206,9 +210,12 @@ jobs:
206210 - uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
207211 with :
208212 submodules : recursive
209- - name : Install cargo-dist
210- shell : bash
211- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.16.0/cargo-dist-installer.sh | sh"
213+ - name : Install cached cargo-dist
214+ uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
215+ with :
216+ name : cargo-dist-cache
217+ path : ~/.cargo/bin/
218+ - run : chmod +x ~/.cargo/bin/cargo-dist
212219 # Get all the local artifacts for the global tasks to use (for e.g. checksums)
213220 - name : Fetch local artifacts
214221 uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
@@ -237,6 +244,8 @@ jobs:
237244 ${{ env.BUILD_MANIFEST_NAME }}
238245 # Determines if we should publish/announce
239246 host :
247+ permissions :
248+ contents : write
240249 needs :
241250 - plan
242251 - build-local-artifacts
@@ -257,16 +266,19 @@ jobs:
257266 - uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
258267 with :
259268 submodules : recursive
260- - name : Install cargo-dist
261- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.16.0/cargo-dist-installer.sh | sh"
269+ - name : Install cached cargo-dist
270+ uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
271+ with :
272+ name : cargo-dist-cache
273+ path : ~/.cargo/bin/
274+ - run : chmod +x ~/.cargo/bin/cargo-dist
262275 # Fetch artifacts from scratch-storage
263276 - name : Fetch artifacts
264277 uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
265278 with :
266279 pattern : artifacts-*
267280 path : target/distrib/
268281 merge-multiple : true
269- # This is a harmless no-op for GitHub Releases, hosting for that happens in "announce"
270282 - id : host
271283 shell : bash
272284 run : |
@@ -280,11 +292,28 @@ jobs:
280292 # Overwrite the previous copy
281293 name : artifacts-dist-manifest
282294 path : dist-manifest.json
295+ # Create a GitHub Release while uploading all files to it
296+ - name : " Download GitHub Artifacts"
297+ uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
298+ with :
299+ pattern : artifacts-*
300+ path : artifacts
301+ merge-multiple : true
302+ - name : Cleanup
303+ run : |
304+ # Remove the granular manifests
305+ rm -f artifacts/*-dist-manifest.json
306+ - name : Create GitHub Release
307+ env :
308+ PRERELEASE_FLAG : " ${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}"
309+ RELEASE_COMMIT : " ${{ github.sha }}"
310+ run : |
311+ # If we're editing a release in place, we need to upload things ahead of time
312+ gh release upload "${{ needs.plan.outputs.tag }}" artifacts/*
313+
314+ gh release edit "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --draft=false
283315
284- # Create a GitHub Release while uploading all files to it
285316 announce :
286- permissions :
287- contents : write
288317 needs :
289318 - plan
290319 - host
@@ -304,24 +333,3 @@ jobs:
304333 - uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
305334 with :
306335 submodules : recursive
307- - name : " Download GitHub Artifacts"
308- uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
309- with :
310- pattern : artifacts-*
311- path : artifacts
312- merge-multiple : true
313- - name : Cleanup
314- run : |
315- # Remove the granular manifests
316- rm -f artifacts/*-dist-manifest.json
317- - name : Create GitHub Release
318- env :
319- PRERELEASE_FLAG : " ${{ fromJson(needs.host.outputs.val).announcement_is_prerelease && '--prerelease' || '' }}"
320- ANNOUNCEMENT_TITLE : " ${{ fromJson(needs.host.outputs.val).announcement_title }}"
321- ANNOUNCEMENT_BODY : " ${{ fromJson(needs.host.outputs.val).announcement_github_body }}"
322- run : |
323- # Write and read notes from a file to avoid quoting breaking things
324- echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt
325-
326- gh release create "${{ needs.plan.outputs.tag }}" --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" $PRERELEASE_FLAG
327- gh release upload "${{ needs.plan.outputs.tag }}" artifacts/*
0 commit comments