1+ # This file was autogenerated by dist: https://github.com/astral-sh/cargo-dist
2+ #
13# Copyright 2022-2024, axodotdev
4+ # Copyright 2025 Astral Software Inc.
25# SPDX-License-Identifier: MIT or Apache-2.0
36#
47# CI that:
58#
69# * checks for a Git Tag that looks like a release
7- # * builds artifacts with cargo- dist (archives, installers, hashes)
10+ # * builds artifacts with dist (archives, installers, hashes)
811# * uploads those artifacts to temporary workflow zip
912# * on success, uploads the artifacts to a GitHub Release
1013#
@@ -22,10 +25,10 @@ permissions:
2225# must be a Cargo-style SemVer Version (must have at least major.minor.patch).
2326#
2427# If PACKAGE_NAME is specified, then the announcement will be for that
25- # 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).
2629#
2730# If PACKAGE_NAME isn't specified, then the announcement will be for all
28- # (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
2932# intended for workspaces with only one dist-able package, or with all dist-able
3033# packages versioned/released in lockstep).
3134#
4346 - ' **[0-9]+.[0-9]+.[0-9]+*'
4447
4548jobs :
46- # 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
4750 plan :
48- runs-on : ubuntu-latest
51+ runs-on : " ubuntu-22.04 "
4952 outputs :
5053 val : ${{ steps.plan.outputs.manifest }}
5154 tag : ${{ !github.event.pull_request && github.ref_name || '' }}
@@ -56,26 +59,27 @@ jobs:
5659 steps :
5760 - uses : actions/checkout@v4
5861 with :
62+ persist-credentials : false
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.19.1 /cargo-dist-installer.sh | sh"
65- - name : Cache cargo- dist
68+ run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh /cargo-dist/releases/download/v0.28.5 /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"
@@ -93,18 +97,19 @@ jobs:
9397 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') }}
9498 strategy :
9599 fail-fast : false
96- # Target platforms/runners are computed by cargo- dist in create-release.
100+ # Target platforms/runners are computed by dist in create-release.
97101 # Each member of the matrix has the following arguments:
98102 #
99103 # - runner: the github runner
100- # - dist-args: cli flags to pass to cargo dist
101- # - 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
102106 #
103107 # Typically there will be:
104108 # - 1 "global" task that builds universal installers
105109 # - N "local" tasks that build each platform's binaries and platform-specific installers
106110 matrix : ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }}
107111 runs-on : ${{ matrix.runner }}
112+ container : ${{ matrix.container && matrix.container.image || null }}
108113 env :
109114 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
110115 BUILD_MANIFEST_NAME : target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
@@ -114,9 +119,17 @@ jobs:
114119 git config --global core.longpaths true
115120 - uses : actions/checkout@v4
116121 with :
122+ persist-credentials : false
117123 submodules : recursive
118- - name : Install cargo-dist
119- 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 }}
120133 # Get the dist-manifest
121134 - name : Fetch local artifacts
122135 uses : actions/download-artifact@v4
@@ -130,8 +143,8 @@ jobs:
130143 - name : Build artifacts
131144 run : |
132145 # Actually do builds and make zips and whatnot
133- cargo dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
134- 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"
135148 - id : cargo-dist
136149 name : Post-build
137150 # We force bash here just because github makes it really hard to get values up
@@ -141,7 +154,7 @@ jobs:
141154 run : |
142155 # Parse out what we just built and upload it to scratch storage
143156 echo "paths<<EOF" >> "$GITHUB_OUTPUT"
144- jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
157+ dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"
145158 echo "EOF" >> "$GITHUB_OUTPUT"
146159
147160 cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -158,20 +171,21 @@ jobs:
158171 needs :
159172 - plan
160173 - build-local-artifacts
161- runs-on : ubuntu-latest
174+ runs-on : " ubuntu-22.04 "
162175 env :
163176 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
164177 BUILD_MANIFEST_NAME : target/distrib/global-dist-manifest.json
165178 steps :
166179 - uses : actions/checkout@v4
167180 with :
181+ persist-credentials : false
168182 submodules : recursive
169- - name : Install cached cargo- dist
183+ - name : Install cached dist
170184 uses : actions/download-artifact@v4
171185 with :
172186 name : cargo-dist-cache
173187 path : ~/.cargo/bin/
174- - run : chmod +x ~/.cargo/bin/cargo- dist
188+ - run : chmod +x ~/.cargo/bin/dist
175189 # Get all the local artifacts for the global tasks to use (for e.g. checksums)
176190 - name : Fetch local artifacts
177191 uses : actions/download-artifact@v4
@@ -182,8 +196,8 @@ jobs:
182196 - id : cargo-dist
183197 shell : bash
184198 run : |
185- cargo dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
186- 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"
187201
188202 # Parse out what we just built and upload it to scratch storage
189203 echo "paths<<EOF" >> "$GITHUB_OUTPUT"
@@ -208,19 +222,20 @@ jobs:
208222 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') }}
209223 env :
210224 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
211- runs-on : ubuntu-latest
225+ runs-on : " ubuntu-22.04 "
212226 outputs :
213227 val : ${{ steps.host.outputs.manifest }}
214228 steps :
215229 - uses : actions/checkout@v4
216230 with :
231+ persist-credentials : false
217232 submodules : recursive
218- - name : Install cached cargo- dist
233+ - name : Install cached dist
219234 uses : actions/download-artifact@v4
220235 with :
221236 name : cargo-dist-cache
222237 path : ~/.cargo/bin/
223- - run : chmod +x ~/.cargo/bin/cargo- dist
238+ - run : chmod +x ~/.cargo/bin/dist
224239 # Fetch artifacts from scratch-storage
225240 - name : Fetch artifacts
226241 uses : actions/download-artifact@v4
@@ -231,7 +246,7 @@ jobs:
231246 - id : host
232247 shell : bash
233248 run : |
234- 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
235250 echo "artifacts uploaded and released successfully"
236251 cat dist-manifest.json
237252 echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
@@ -272,10 +287,11 @@ jobs:
272287 # still allowing individual publish jobs to skip themselves (for prereleases).
273288 # "host" however must run to completion, no skipping allowed!
274289 if : ${{ always() && needs.host.result == 'success' }}
275- runs-on : ubuntu-latest
290+ runs-on : " ubuntu-22.04 "
276291 env :
277292 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
278293 steps :
279294 - uses : actions/checkout@v4
280295 with :
296+ persist-credentials : false
281297 submodules : recursive
0 commit comments