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#
@@ -24,10 +24,10 @@ permissions:
2424# must be a Cargo-style SemVer Version (must have at least major.minor.patch).
2525#
2626# 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).
27+ # package (erroring out if it doesn't have the given version or isn't dist-able).
2828#
2929# 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
30+ # (dist-able) packages in the workspace with that version (this mode is
3131# intended for workspaces with only one dist-able package, or with all dist-able
3232# packages versioned/released in lockstep).
3333#
4545 - ' **[0-9]+.[0-9]+.[0-9]+*'
4646
4747jobs :
48- # Run 'cargo dist plan' (or host) to determine what tasks we need to do
48+ # Run 'dist plan' (or host) to determine what tasks we need to do
4949 plan :
50- runs-on : " ubuntu-20 .04"
50+ runs-on : " ubuntu-22 .04"
5151 outputs :
5252 val : ${{ steps.plan.outputs.manifest }}
5353 tag : ${{ !github.event.pull_request && github.ref_name || '' }}
@@ -58,26 +58,27 @@ jobs:
5858 steps :
5959 - uses : actions/checkout@v4
6060 with :
61+ persist-credentials : false
6162 submodules : recursive
62- - name : Install cargo- dist
63+ - name : Install dist
6364 # we specify bash to get pipefail; it guards against the `curl` command
6465 # failing. otherwise `sh` won't catch that `curl` returned non-0
6566 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
67+ run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.30.3 /cargo-dist-installer.sh | sh"
68+ - name : Cache dist
6869 uses : actions/upload-artifact@v4
6970 with :
7071 name : cargo-dist-cache
71- path : ~/.cargo/bin/cargo- dist
72+ path : ~/.cargo/bin/dist
7273 # sure would be cool if github gave us proper conditionals...
7374 # so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
7475 # functionality based on whether this is a pull_request, and whether it's from a fork.
7576 # (PRs run on the *source* but secrets are usually on the *target* -- that's *good*
7677 # but also really annoying to build CI around when it needs secrets to work right.)
7778 - id : plan
7879 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"
80+ dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
81+ echo "dist ran successfully"
8182 cat plan-dist-manifest.json
8283 echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
8384 - name : " Upload dist-manifest.json"
@@ -95,18 +96,19 @@ jobs:
9596 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') }}
9697 strategy :
9798 fail-fast : false
98- # Target platforms/runners are computed by cargo- dist in create-release.
99+ # Target platforms/runners are computed by dist in create-release.
99100 # Each member of the matrix has the following arguments:
100101 #
101102 # - 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
103+ # - dist-args: cli flags to pass to dist
104+ # - install-dist: expression to run to install dist on the runner
104105 #
105106 # Typically there will be:
106107 # - 1 "global" task that builds universal installers
107108 # - N "local" tasks that build each platform's binaries and platform-specific installers
108109 matrix : ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }}
109110 runs-on : ${{ matrix.runner }}
111+ container : ${{ matrix.container && matrix.container.image || null }}
110112 env :
111113 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
112114 BUILD_MANIFEST_NAME : target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
@@ -116,13 +118,21 @@ jobs:
116118 git config --global core.longpaths true
117119 - uses : actions/checkout@v4
118120 with :
121+ persist-credentials : false
119122 submodules : recursive
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
120130 - uses : swatinem/rust-cache@v2
121131 with :
122132 key : ${{ join(matrix.targets, '-') }}
123133 cache-provider : ${{ matrix.cache_provider }}
124- - name : Install cargo- dist
125- run : ${{ matrix.install_dist }}
134+ - name : Install dist
135+ run : ${{ matrix.install_dist.run }}
126136 # Get the dist-manifest
127137 - name : Fetch local artifacts
128138 uses : actions/download-artifact@v4
@@ -136,8 +146,8 @@ jobs:
136146 - name : Build artifacts
137147 run : |
138148 # Actually do builds and make zips and whatnot
139- cargo dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
140- echo "cargo dist ran successfully"
149+ dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
150+ echo "dist ran successfully"
141151 - id : cargo-dist
142152 name : Post-build
143153 # We force bash here just because github makes it really hard to get values up
@@ -147,7 +157,7 @@ jobs:
147157 run : |
148158 # Parse out what we just built and upload it to scratch storage
149159 echo "paths<<EOF" >> "$GITHUB_OUTPUT"
150- jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
160+ dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"
151161 echo "EOF" >> "$GITHUB_OUTPUT"
152162
153163 cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -164,20 +174,21 @@ jobs:
164174 needs :
165175 - plan
166176 - build-local-artifacts
167- runs-on : " ubuntu-20 .04"
177+ runs-on : " ubuntu-22 .04"
168178 env :
169179 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
170180 BUILD_MANIFEST_NAME : target/distrib/global-dist-manifest.json
171181 steps :
172182 - uses : actions/checkout@v4
173183 with :
184+ persist-credentials : false
174185 submodules : recursive
175- - name : Install cached cargo- dist
186+ - name : Install cached dist
176187 uses : actions/download-artifact@v4
177188 with :
178189 name : cargo-dist-cache
179190 path : ~/.cargo/bin/
180- - run : chmod +x ~/.cargo/bin/cargo- dist
191+ - run : chmod +x ~/.cargo/bin/dist
181192 # Get all the local artifacts for the global tasks to use (for e.g. checksums)
182193 - name : Fetch local artifacts
183194 uses : actions/download-artifact@v4
@@ -188,8 +199,8 @@ jobs:
188199 - id : cargo-dist
189200 shell : bash
190201 run : |
191- cargo dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
192- echo "cargo dist ran successfully"
202+ dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
203+ echo "dist ran successfully"
193204
194205 # Parse out what we just built and upload it to scratch storage
195206 echo "paths<<EOF" >> "$GITHUB_OUTPUT"
@@ -210,23 +221,24 @@ jobs:
210221 - plan
211222 - build-local-artifacts
212223 - build-global-artifacts
213- # Only run if we're "publishing", and only if local and global didn't fail (skipped is fine)
214- 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') }}
224+ # Only run if we're "publishing", and only if plan, local and global didn't fail (skipped is fine)
225+ if : ${{ always() && needs.plan.result == 'success' && 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') }}
215226 env :
216227 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
217- runs-on : " ubuntu-20 .04"
228+ runs-on : " ubuntu-22 .04"
218229 outputs :
219230 val : ${{ steps.host.outputs.manifest }}
220231 steps :
221232 - uses : actions/checkout@v4
222233 with :
234+ persist-credentials : false
223235 submodules : recursive
224- - name : Install cached cargo- dist
236+ - name : Install cached dist
225237 uses : actions/download-artifact@v4
226238 with :
227239 name : cargo-dist-cache
228240 path : ~/.cargo/bin/
229- - run : chmod +x ~/.cargo/bin/cargo- dist
241+ - run : chmod +x ~/.cargo/bin/dist
230242 # Fetch artifacts from scratch-storage
231243 - name : Fetch artifacts
232244 uses : actions/download-artifact@v4
@@ -237,7 +249,7 @@ jobs:
237249 - id : host
238250 shell : bash
239251 run : |
240- cargo dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
252+ dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
241253 echo "artifacts uploaded and released successfully"
242254 cat dist-manifest.json
243255 echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
@@ -278,10 +290,11 @@ jobs:
278290 # still allowing individual publish jobs to skip themselves (for prereleases).
279291 # "host" however must run to completion, no skipping allowed!
280292 if : ${{ always() && needs.host.result == 'success' }}
281- runs-on : " ubuntu-20 .04"
293+ runs-on : " ubuntu-22 .04"
282294 env :
283295 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
284296 steps :
285297 - uses : actions/checkout@v4
286298 with :
299+ persist-credentials : false
287300 submodules : recursive
0 commit comments