1- # This file was autogenerated by cargo- dist: https://opensource.axo.dev/ cargo-dist/
1+ # This file was autogenerated by dist: https://github.com/astral-sh/ cargo-dist
22#
33# Copyright 2022-2024, axodotdev
4+ # Copyright 2025 Astral Software Inc.
45# SPDX-License-Identifier: MIT or Apache-2.0
56#
67# CI that:
78#
89# * checks for a Git Tag that looks like a release
9- # * builds artifacts with cargo- dist (archives, installers, hashes)
10+ # * builds artifacts with dist (archives, installers, hashes)
1011# * uploads those artifacts to temporary workflow zip
1112# * on success, uploads the artifacts to a GitHub Release
1213#
@@ -24,10 +25,10 @@ permissions:
2425# must be a Cargo-style SemVer Version (must have at least major.minor.patch).
2526#
2627# If PACKAGE_NAME is specified, then the announcement will be for that
27- # package (erroring out if it doesn't have the given version or isn't cargo- dist-able).
28+ # package (erroring out if it doesn't have the given version or isn't dist-able).
2829#
2930# If PACKAGE_NAME isn't specified, then the announcement will be for all
30- # (cargo- dist-able) packages in the workspace with that version (this mode is
31+ # (dist-able) packages in the workspace with that version (this mode is
3132# intended for workspaces with only one dist-able package, or with all dist-able
3233# packages versioned/released in lockstep).
3334#
4546 - ' **[0-9]+.[0-9]+.[0-9]+*'
4647
4748jobs :
48- # Run 'cargo dist plan' (or host) to determine what tasks we need to do
49+ # Run 'dist plan' (or host) to determine what tasks we need to do
4950 plan :
50- runs-on : " ubuntu-latest "
51+ runs-on : " ubuntu-22.04 "
5152 outputs :
5253 val : ${{ steps.plan.outputs.manifest }}
5354 tag : ${{ !github.event.pull_request && github.ref_name || '' }}
@@ -58,26 +59,27 @@ jobs:
5859 steps :
5960 - uses : actions/checkout@v4
6061 with :
62+ persist-credentials : false
6163 submodules : recursive
62- - name : Install cargo- dist
64+ - name : Install dist
6365 # we specify bash to get pipefail; it guards against the `curl` command
6466 # failing. otherwise `sh` won't catch that `curl` returned non-0
6567 shell : bash
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+ run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh /cargo-dist/releases/download/v0.28.7-prerelease .1/cargo-dist-installer.sh | sh"
69+ - name : Cache dist
6870 uses : actions/upload-artifact@v4
6971 with :
7072 name : cargo-dist-cache
71- path : ~/.cargo/bin/cargo- dist
73+ path : ~/.cargo/bin/dist
7274 # sure would be cool if github gave us proper conditionals...
7375 # so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
7476 # functionality based on whether this is a pull_request, and whether it's from a fork.
7577 # (PRs run on the *source* but secrets are usually on the *target* -- that's *good*
7678 # but also really annoying to build CI around when it needs secrets to work right.)
7779 - id : plan
7880 run : |
79- cargo dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
80- 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"
8183 cat plan-dist-manifest.json
8284 echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
8385 - name : " Upload dist-manifest.json"
@@ -95,18 +97,19 @@ jobs:
9597 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') }}
9698 strategy :
9799 fail-fast : false
98- # Target platforms/runners are computed by cargo- dist in create-release.
100+ # Target platforms/runners are computed by dist in create-release.
99101 # Each member of the matrix has the following arguments:
100102 #
101103 # - runner: the github runner
102- # - dist-args: cli flags to pass to cargo dist
103- # - 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
104106 #
105107 # Typically there will be:
106108 # - 1 "global" task that builds universal installers
107109 # - N "local" tasks that build each platform's binaries and platform-specific installers
108110 matrix : ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }}
109111 runs-on : ${{ matrix.runner }}
112+ container : ${{ matrix.container && matrix.container.image || null }}
110113 env :
111114 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
112115 BUILD_MANIFEST_NAME : target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
@@ -116,9 +119,17 @@ jobs:
116119 git config --global core.longpaths true
117120 - uses : actions/checkout@v4
118121 with :
122+ persist-credentials : false
119123 submodules : recursive
120- - name : Install cargo-dist
121- run : ${{ matrix.install_dist }}
124+ - name : Install Rust non-interactively if not already installed
125+ if : ${{ matrix.container }}
126+ run : |
127+ if ! command -v cargo > /dev/null 2>&1; then
128+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
129+ echo "$HOME/.cargo/bin" >> $GITHUB_PATH
130+ fi
131+ - name : Install dist
132+ run : ${{ matrix.install_dist.run }}
122133 # Get the dist-manifest
123134 - name : Fetch local artifacts
124135 uses : actions/download-artifact@v4
@@ -132,8 +143,8 @@ jobs:
132143 - name : Build artifacts
133144 run : |
134145 # Actually do builds and make zips and whatnot
135- cargo dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
136- echo "cargo dist ran successfully"
146+ dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
147+ echo "dist ran successfully"
137148 - id : cargo-dist
138149 name : Post-build
139150 # We force bash here just because github makes it really hard to get values up
@@ -143,7 +154,7 @@ jobs:
143154 run : |
144155 # Parse out what we just built and upload it to scratch storage
145156 echo "paths<<EOF" >> "$GITHUB_OUTPUT"
146- jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
157+ dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"
147158 echo "EOF" >> "$GITHUB_OUTPUT"
148159
149160 cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -160,20 +171,21 @@ jobs:
160171 needs :
161172 - plan
162173 - build-local-artifacts
163- runs-on : " ubuntu-latest "
174+ runs-on : " ubuntu-22.04 "
164175 env :
165176 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
166177 BUILD_MANIFEST_NAME : target/distrib/global-dist-manifest.json
167178 steps :
168179 - uses : actions/checkout@v4
169180 with :
181+ persist-credentials : false
170182 submodules : recursive
171- - name : Install cached cargo- dist
183+ - name : Install cached dist
172184 uses : actions/download-artifact@v4
173185 with :
174186 name : cargo-dist-cache
175187 path : ~/.cargo/bin/
176- - run : chmod +x ~/.cargo/bin/cargo- dist
188+ - run : chmod +x ~/.cargo/bin/dist
177189 # Get all the local artifacts for the global tasks to use (for e.g. checksums)
178190 - name : Fetch local artifacts
179191 uses : actions/download-artifact@v4
@@ -184,8 +196,8 @@ jobs:
184196 - id : cargo-dist
185197 shell : bash
186198 run : |
187- cargo dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
188- echo "cargo dist ran successfully"
199+ dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
200+ echo "dist ran successfully"
189201
190202 # Parse out what we just built and upload it to scratch storage
191203 echo "paths<<EOF" >> "$GITHUB_OUTPUT"
@@ -210,19 +222,20 @@ jobs:
210222 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') }}
211223 env :
212224 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
213- runs-on : " ubuntu-latest "
225+ runs-on : " ubuntu-22.04 "
214226 outputs :
215227 val : ${{ steps.host.outputs.manifest }}
216228 steps :
217229 - uses : actions/checkout@v4
218230 with :
231+ persist-credentials : false
219232 submodules : recursive
220- - name : Install cached cargo- dist
233+ - name : Install cached dist
221234 uses : actions/download-artifact@v4
222235 with :
223236 name : cargo-dist-cache
224237 path : ~/.cargo/bin/
225- - run : chmod +x ~/.cargo/bin/cargo- dist
238+ - run : chmod +x ~/.cargo/bin/dist
226239 # Fetch artifacts from scratch-storage
227240 - name : Fetch artifacts
228241 uses : actions/download-artifact@v4
@@ -233,7 +246,7 @@ jobs:
233246 - id : host
234247 shell : bash
235248 run : |
236- cargo dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
249+ dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
237250 echo "artifacts uploaded and released successfully"
238251 cat dist-manifest.json
239252 echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
@@ -274,10 +287,11 @@ jobs:
274287 # still allowing individual publish jobs to skip themselves (for prereleases).
275288 # "host" however must run to completion, no skipping allowed!
276289 if : ${{ always() && needs.host.result == 'success' }}
277- runs-on : " ubuntu-latest "
290+ runs-on : " ubuntu-22.04 "
278291 env :
279292 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
280293 steps :
281294 - uses : actions/checkout@v4
282295 with :
296+ persist-credentials : false
283297 submodules : recursive
0 commit comments