1- # This file was autogenerated by cargo- dist: https://opensource.axo.dev /cargo-dist/
1+ # This file was autogenerated by dist: https://axodotdev.github.io /cargo-dist
22#
33# Copyright 2022-2024, axodotdev
44# SPDX-License-Identifier: MIT or Apache-2.0
55#
66# CI that:
77#
88# * checks for a Git Tag that looks like a release
9- # * builds artifacts with cargo- dist (archives, installers, hashes)
9+ # * builds artifacts with dist (archives, installers, hashes)
1010# * uploads those artifacts to temporary workflow zip
1111# * on success, uploads the artifacts to a GitHub Release
1212#
1515
1616name : Release
1717permissions :
18+ " attestations " : " write"
1819 " contents " : " write"
20+ " id-token " : " write"
21+
1922# This task will run whenever you push a git tag that looks like a version
2023# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc.
2124# Various formats will be parsed into a VERSION and an optional PACKAGE_NAME, where
2225# PACKAGE_NAME must be the name of a Cargo package in your workspace, and VERSION
2326# must be a Cargo-style SemVer Version (must have at least major.minor.patch).
2427#
2528# If PACKAGE_NAME is specified, then the announcement will be for that
26- # package (erroring out if it doesn't have the given version or isn't cargo- dist-able).
29+ # package (erroring out if it doesn't have the given version or isn't dist-able).
2730#
2831# If PACKAGE_NAME isn't specified, then the announcement will be for all
29- # (cargo- dist-able) packages in the workspace with that version (this mode is
32+ # (dist-able) packages in the workspace with that version (this mode is
3033# intended for workspaces with only one dist-able package, or with all dist-able
3134# packages versioned/released in lockstep).
3235#
4245 push :
4346 tags :
4447 - ' **[0-9]+.[0-9]+.[0-9]+*'
48+
4549jobs :
46- # Run 'cargo dist plan' (or host) to determine what tasks we need to do
50+ # Run 'dist plan' (or host) to determine what tasks we need to do
4751 plan :
48- runs-on : " ubuntu-20 .04"
52+ runs-on : " ubuntu-22 .04"
4953 outputs :
5054 val : ${{ steps.plan.outputs.manifest }}
5155 tag : ${{ !github.event.pull_request && github.ref_name || '' }}
@@ -57,32 +61,33 @@ jobs:
5761 - uses : actions/checkout@v4
5862 with :
5963 submodules : recursive
60- - name : Install cargo- dist
64+ - name : Install dist
6165 # we specify bash to get pipefail; it guards against the `curl` command
6266 # failing. otherwise `sh` won't catch that `curl` returned non-0
6367 shell : bash
64- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.21.1 /cargo-dist-installer.sh | sh"
65- - name : Cache cargo- dist
68+ run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.28.2-prerelease.2 /cargo-dist-installer.sh | sh"
69+ - name : Cache dist
6670 uses : actions/upload-artifact@v4
6771 with :
6872 name : cargo-dist-cache
69- path : ~/.cargo/bin/cargo- dist
73+ path : ~/.cargo/bin/dist
7074 # sure would be cool if github gave us proper conditionals...
7175 # so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
7276 # functionality based on whether this is a pull_request, and whether it's from a fork.
7377 # (PRs run on the *source* but secrets are usually on the *target* -- that's *good*
7478 # but also really annoying to build CI around when it needs secrets to work right.)
7579 - id : plan
7680 run : |
77- cargo dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
78- echo "cargo dist ran successfully"
81+ dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
82+ echo "dist ran successfully"
7983 cat plan-dist-manifest.json
8084 echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
8185 - name : " Upload dist-manifest.json"
8286 uses : actions/upload-artifact@v4
8387 with :
8488 name : artifacts-plan-dist-manifest
8589 path : plan-dist-manifest.json
90+
8691 # Build and packages all the platform-specific things
8792 build-local-artifacts :
8893 name : build-local-artifacts (${{ join(matrix.targets, ', ') }})
@@ -92,18 +97,19 @@ jobs:
9297 if : ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') }}
9398 strategy :
9499 fail-fast : false
95- # Target platforms/runners are computed by cargo- dist in create-release.
100+ # Target platforms/runners are computed by dist in create-release.
96101 # Each member of the matrix has the following arguments:
97102 #
98103 # - runner: the github runner
99- # - dist-args: cli flags to pass to cargo dist
100- # - install-dist: expression to run to install cargo- dist on the runner
104+ # - dist-args: cli flags to pass to dist
105+ # - install-dist: expression to run to install dist on the runner
101106 #
102107 # Typically there will be:
103108 # - 1 "global" task that builds universal installers
104109 # - N "local" tasks that build each platform's binaries and platform-specific installers
105110 matrix : ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }}
106111 runs-on : ${{ matrix.runner }}
112+ container : ${{ matrix.container && matrix.container.image || null }}
107113 env :
108114 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
109115 BUILD_MANIFEST_NAME : target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
@@ -114,8 +120,15 @@ jobs:
114120 - uses : actions/checkout@v4
115121 with :
116122 submodules : recursive
117- - name : Install cargo-dist
118- run : ${{ matrix.install_dist }}
123+ - name : Install Rust non-interactively if not already installed
124+ if : ${{ matrix.container }}
125+ run : |
126+ if ! command -v cargo > /dev/null 2>&1; then
127+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
128+ echo "$HOME/.cargo/bin" >> $GITHUB_PATH
129+ fi
130+ - name : Install dist
131+ run : ${{ matrix.install_dist.run }}
119132 # Get the dist-manifest
120133 - name : Fetch local artifacts
121134 uses : actions/download-artifact@v4
@@ -141,8 +154,12 @@ jobs:
141154 - name : Build artifacts
142155 run : |
143156 # Actually do builds and make zips and whatnot
144- cargo dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
145- echo "cargo dist ran successfully"
157+ dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
158+ echo "dist ran successfully"
159+ - name : Attest
160+ uses : actions/attest-build-provenance@v2
161+ with :
162+ subject-path : " target/distrib/*${{ join(matrix.targets, ', ') }}*"
146163 - id : cargo-dist
147164 name : Post-build
148165 # We force bash here just because github makes it really hard to get values up
@@ -152,7 +169,7 @@ jobs:
152169 run : |
153170 # Parse out what we just built and upload it to scratch storage
154171 echo "paths<<EOF" >> "$GITHUB_OUTPUT"
155- jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
172+ dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"
156173 echo "EOF" >> "$GITHUB_OUTPUT"
157174
158175 cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -163,25 +180,26 @@ jobs:
163180 path : |
164181 ${{ steps.cargo-dist.outputs.paths }}
165182 ${{ env.BUILD_MANIFEST_NAME }}
183+
166184 # Build and package all the platform-agnostic(ish) things
167185 build-global-artifacts :
168186 needs :
169187 - plan
170188 - build-local-artifacts
171- runs-on : " ubuntu-20 .04"
189+ runs-on : " ubuntu-22 .04"
172190 env :
173191 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
174192 BUILD_MANIFEST_NAME : target/distrib/global-dist-manifest.json
175193 steps :
176194 - uses : actions/checkout@v4
177195 with :
178196 submodules : recursive
179- - name : Install cached cargo- dist
197+ - name : Install cached dist
180198 uses : actions/download-artifact@v4
181199 with :
182200 name : cargo-dist-cache
183201 path : ~/.cargo/bin/
184- - run : chmod +x ~/.cargo/bin/cargo- dist
202+ - run : chmod +x ~/.cargo/bin/dist
185203 # Get all the local artifacts for the global tasks to use (for e.g. checksums)
186204 - name : Fetch local artifacts
187205 uses : actions/download-artifact@v4
@@ -192,8 +210,8 @@ jobs:
192210 - id : cargo-dist
193211 shell : bash
194212 run : |
195- cargo dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
196- echo "cargo dist ran successfully"
213+ dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
214+ echo "dist ran successfully"
197215
198216 # Parse out what we just built and upload it to scratch storage
199217 echo "paths<<EOF" >> "$GITHUB_OUTPUT"
@@ -218,19 +236,19 @@ jobs:
218236 if : ${{ always() && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }}
219237 env :
220238 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
221- runs-on : " ubuntu-20 .04"
239+ runs-on : " ubuntu-22 .04"
222240 outputs :
223241 val : ${{ steps.host.outputs.manifest }}
224242 steps :
225243 - uses : actions/checkout@v4
226244 with :
227245 submodules : recursive
228- - name : Install cached cargo- dist
246+ - name : Install cached dist
229247 uses : actions/download-artifact@v4
230248 with :
231249 name : cargo-dist-cache
232250 path : ~/.cargo/bin/
233- - run : chmod +x ~/.cargo/bin/cargo- dist
251+ - run : chmod +x ~/.cargo/bin/dist
234252 # Fetch artifacts from scratch-storage
235253 - name : Fetch artifacts
236254 uses : actions/download-artifact@v4
@@ -241,7 +259,7 @@ jobs:
241259 - id : host
242260 shell : bash
243261 run : |
244- cargo dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
262+ dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
245263 echo "artifacts uploaded and released successfully"
246264 cat dist-manifest.json
247265 echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
@@ -281,7 +299,7 @@ jobs:
281299 # still allowing individual publish jobs to skip themselves (for prereleases).
282300 # "host" however must run to completion, no skipping allowed!
283301 if : ${{ always() && needs.host.result == 'success' }}
284- runs-on : " ubuntu-20 .04"
302+ runs-on : " ubuntu-22 .04"
285303 env :
286304 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
287305 steps :
0 commit comments