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.23.0 /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.2 /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,9 +118,17 @@ jobs:
116118 git config --global core.longpaths true
117119 - uses : actions/checkout@v4
118120 with :
121+ persist-credentials : false
119122 submodules : recursive
120- - name : Install cargo-dist
121- 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 }}
122132 # Get the dist-manifest
123133 - name : Fetch local artifacts
124134 uses : actions/download-artifact@v4
@@ -132,8 +142,8 @@ jobs:
132142 - name : Build artifacts
133143 run : |
134144 # 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"
145+ dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
146+ echo "dist ran successfully"
137147 - id : cargo-dist
138148 name : Post-build
139149 # We force bash here just because github makes it really hard to get values up
@@ -143,7 +153,7 @@ jobs:
143153 run : |
144154 # Parse out what we just built and upload it to scratch storage
145155 echo "paths<<EOF" >> "$GITHUB_OUTPUT"
146- jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
156+ dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"
147157 echo "EOF" >> "$GITHUB_OUTPUT"
148158
149159 cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -160,20 +170,21 @@ jobs:
160170 needs :
161171 - plan
162172 - build-local-artifacts
163- runs-on : " ubuntu-20 .04"
173+ runs-on : " ubuntu-22 .04"
164174 env :
165175 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
166176 BUILD_MANIFEST_NAME : target/distrib/global-dist-manifest.json
167177 steps :
168178 - uses : actions/checkout@v4
169179 with :
180+ persist-credentials : false
170181 submodules : recursive
171- - name : Install cached cargo- dist
182+ - name : Install cached dist
172183 uses : actions/download-artifact@v4
173184 with :
174185 name : cargo-dist-cache
175186 path : ~/.cargo/bin/
176- - run : chmod +x ~/.cargo/bin/cargo- dist
187+ - run : chmod +x ~/.cargo/bin/dist
177188 # Get all the local artifacts for the global tasks to use (for e.g. checksums)
178189 - name : Fetch local artifacts
179190 uses : actions/download-artifact@v4
@@ -184,8 +195,8 @@ jobs:
184195 - id : cargo-dist
185196 shell : bash
186197 run : |
187- cargo dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
188- echo "cargo dist ran successfully"
198+ dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
199+ echo "dist ran successfully"
189200
190201 # Parse out what we just built and upload it to scratch storage
191202 echo "paths<<EOF" >> "$GITHUB_OUTPUT"
@@ -206,23 +217,24 @@ jobs:
206217 - plan
207218 - build-local-artifacts
208219 - build-global-artifacts
209- # Only run if we're "publishing", and only if local and global didn't fail (skipped is fine)
210- 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') }}
220+ # Only run if we're "publishing", and only if plan, local and global didn't fail (skipped is fine)
221+ 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') }}
211222 env :
212223 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
213- runs-on : " ubuntu-20 .04"
224+ runs-on : " ubuntu-22 .04"
214225 outputs :
215226 val : ${{ steps.host.outputs.manifest }}
216227 steps :
217228 - uses : actions/checkout@v4
218229 with :
230+ persist-credentials : false
219231 submodules : recursive
220- - name : Install cached cargo- dist
232+ - name : Install cached dist
221233 uses : actions/download-artifact@v4
222234 with :
223235 name : cargo-dist-cache
224236 path : ~/.cargo/bin/
225- - run : chmod +x ~/.cargo/bin/cargo- dist
237+ - run : chmod +x ~/.cargo/bin/dist
226238 # Fetch artifacts from scratch-storage
227239 - name : Fetch artifacts
228240 uses : actions/download-artifact@v4
@@ -233,7 +245,7 @@ jobs:
233245 - id : host
234246 shell : bash
235247 run : |
236- cargo dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
248+ dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
237249 echo "artifacts uploaded and released successfully"
238250 cat dist-manifest.json
239251 echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
@@ -270,7 +282,7 @@ jobs:
270282 needs :
271283 - plan
272284 - host
273- runs-on : " ubuntu-20 .04"
285+ runs-on : " ubuntu-22 .04"
274286 env :
275287 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
276288 PLAN : ${{ needs.plan.outputs.val }}
@@ -303,10 +315,11 @@ jobs:
303315 # still allowing individual publish jobs to skip themselves (for prereleases).
304316 # "host" however must run to completion, no skipping allowed!
305317 if : ${{ always() && needs.host.result == 'success' && (needs.publish-npm.result == 'skipped' || needs.publish-npm.result == 'success') }}
306- runs-on : " ubuntu-20 .04"
318+ runs-on : " ubuntu-22 .04"
307319 env :
308320 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
309321 steps :
310322 - uses : actions/checkout@v4
311323 with :
324+ persist-credentials : false
312325 submodules : recursive
0 commit comments