1+ # This file was autogenerated by dist: https://opensource.axo.dev/cargo-dist/
2+ #
13# Copyright 2022-2024, axodotdev
24# SPDX-License-Identifier: MIT or Apache-2.0
35#
46# CI that:
57#
68# * checks for a Git Tag that looks like a release
7- # * builds artifacts with cargo- dist (archives, installers, hashes)
9+ # * builds artifacts with dist (archives, installers, hashes)
810# * uploads those artifacts to temporary workflow zip
911# * on success, uploads the artifacts to a GitHub Release
1012#
@@ -22,10 +24,10 @@ permissions:
2224# must be a Cargo-style SemVer Version (must have at least major.minor.patch).
2325#
2426# 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).
27+ # package (erroring out if it doesn't have the given version or isn't dist-able).
2628#
2729# 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
30+ # (dist-able) packages in the workspace with that version (this mode is
2931# intended for workspaces with only one dist-able package, or with all dist-able
3032# packages versioned/released in lockstep).
3133#
4345 - ' **[0-9]+.[0-9]+.[0-9]+*'
4446
4547jobs :
46- # 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
4749 plan :
48- runs-on : " ubuntu-latest"
49-
50+ runs-on : " ubuntu-20.04"
5051 outputs :
51- manifest : ${{ steps.plan.outputs.manifest }}
52+ val : ${{ steps.plan.outputs.manifest }}
5253 tag : ${{ !github.event.pull_request && github.ref_name || '' }}
5354 tag-flag : ${{ !github.event.pull_request && format('--tag={0}', github.ref_name) || '' }}
5455 publishing : ${{ !github.event.pull_request }}
55-
5656 env :
5757 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
58-
5958 steps :
60- - name : Checkout
61- uses : actions/checkout@v4
62-
63- - name : Install cargo-dist
64- run : |
65- set -eo pipefail
66-
67- curl \
68- --proto '=https' \
69- --tlsv1.2 \
70- -LsSf \
71- https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-installer.sh \
72- | sh
73-
74- - name : Cache cargo-dist
59+ - uses : actions/checkout@v4
60+ with :
61+ submodules : recursive
62+ - name : Install dist
63+ # we specify bash to get pipefail; it guards against the `curl` command
64+ # failing. otherwise `sh` won't catch that `curl` returned non-0
65+ shell : bash
66+ run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-installer.sh | sh"
67+ - name : Cache dist
7568 uses : actions/upload-artifact@v4
7669 with :
7770 name : cargo-dist-cache
78- path : ~/.cargo/bin/cargo-dist
79-
71+ path : ~/.cargo/bin/dist
8072 # sure would be cool if github gave us proper conditionals...
8173 # so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
8274 # functionality based on whether this is a pull_request, and whether it's from a fork.
8375 # (PRs run on the *source* but secrets are usually on the *target* -- that's *good*
8476 # but also really annoying to build CI around when it needs secrets to work right.)
85- - name : Create release manifest
86- id : plan
77+ - id : plan
8778 run : |
88- cargo dist \
89- ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} \
90- --output-format=json \
91- > plan-dist-manifest.json
92-
93- echo "cargo dist ran successfully"
79+ dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
80+ echo "dist ran successfully"
9481 cat plan-dist-manifest.json
95-
9682 echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
97-
9883 - name : " Upload dist-manifest.json"
9984 uses : actions/upload-artifact@v4
10085 with :
@@ -107,21 +92,22 @@ jobs:
10792 # Let the initial task tell us to not run (currently very blunt)
10893 needs :
10994 - plan
110- if : ${{ fromJson(needs.plan.outputs.manifest ).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.manifest ).ci.github.pr_run_mode == 'upload') }}
95+ 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') }}
11196 strategy :
11297 fail-fast : false
113- # Target platforms/runners are computed by cargo- dist in create-release.
98+ # Target platforms/runners are computed by dist in create-release.
11499 # Each member of the matrix has the following arguments:
115100 #
116101 # - runner: the github runner
117- # - dist-args: cli flags to pass to cargo dist
118- # - install-dist: expression to run to install cargo- dist on the runner
102+ # - dist-args: cli flags to pass to dist
103+ # - install-dist: expression to run to install dist on the runner
119104 #
120105 # Typically there will be:
121106 # - 1 "global" task that builds universal installers
122107 # - N "local" tasks that build each platform's binaries and platform-specific installers
123- matrix : ${{ fromJson(needs.plan.outputs.manifest ).ci.github.artifacts_matrix }}
108+ matrix : ${{ fromJson(needs.plan.outputs.val ).ci.github.artifacts_matrix }}
124109 runs-on : ${{ matrix.runner }}
110+ container : ${{ matrix.container && matrix.container.image || null }}
125111 env :
126112 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
127113 BUILD_MANIFEST_NAME : target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
@@ -132,8 +118,15 @@ jobs:
132118 - uses : actions/checkout@v4
133119 with :
134120 submodules : recursive
135- - name : Install cargo-dist
136- run : ${{ matrix.install_dist }}
121+ - name : Install Rust non-interactively if not already installed
122+ if : ${{ matrix.container }}
123+ run : |
124+ if ! command -v cargo > /dev/null 2>&1; then
125+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
126+ echo "$HOME/.cargo/bin" >> $GITHUB_PATH
127+ fi
128+ - name : Install dist
129+ run : ${{ matrix.install_dist.run }}
137130 # Get the dist-manifest
138131 - name : Fetch local artifacts
139132 uses : actions/download-artifact@v4
@@ -147,8 +140,8 @@ jobs:
147140 - name : Build artifacts
148141 run : |
149142 # Actually do builds and make zips and whatnot
150- cargo dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
151- echo "cargo dist ran successfully"
143+ dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
144+ echo "dist ran successfully"
152145 - id : cargo-dist
153146 name : Post-build
154147 # We force bash here just because github makes it really hard to get values up
@@ -158,7 +151,7 @@ jobs:
158151 run : |
159152 # Parse out what we just built and upload it to scratch storage
160153 echo "paths<<EOF" >> "$GITHUB_OUTPUT"
161- jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
154+ dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"
162155 echo "EOF" >> "$GITHUB_OUTPUT"
163156
164157 cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -175,20 +168,20 @@ jobs:
175168 needs :
176169 - plan
177170 - build-local-artifacts
178- runs-on : " ubuntu-latest "
171+ runs-on : " ubuntu-20.04 "
179172 env :
180173 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
181174 BUILD_MANIFEST_NAME : target/distrib/global-dist-manifest.json
182175 steps :
183176 - uses : actions/checkout@v4
184177 with :
185178 submodules : recursive
186- - name : Install cached cargo- dist
179+ - name : Install cached dist
187180 uses : actions/download-artifact@v4
188181 with :
189182 name : cargo-dist-cache
190183 path : ~/.cargo/bin/
191- - run : chmod +x ~/.cargo/bin/cargo- dist
184+ - run : chmod +x ~/.cargo/bin/dist
192185 # Get all the local artifacts for the global tasks to use (for e.g. checksums)
193186 - name : Fetch local artifacts
194187 uses : actions/download-artifact@v4
@@ -199,8 +192,8 @@ jobs:
199192 - id : cargo-dist
200193 shell : bash
201194 run : |
202- cargo dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
203- echo "cargo dist ran successfully"
195+ dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
196+ echo "dist ran successfully"
204197
205198 # Parse out what we just built and upload it to scratch storage
206199 echo "paths<<EOF" >> "$GITHUB_OUTPUT"
@@ -225,19 +218,19 @@ jobs:
225218 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') }}
226219 env :
227220 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
228- runs-on : " ubuntu-latest "
221+ runs-on : " ubuntu-20.04 "
229222 outputs :
230223 val : ${{ steps.host.outputs.manifest }}
231224 steps :
232225 - uses : actions/checkout@v4
233226 with :
234227 submodules : recursive
235- - name : Install cached cargo- dist
228+ - name : Install cached dist
236229 uses : actions/download-artifact@v4
237230 with :
238231 name : cargo-dist-cache
239232 path : ~/.cargo/bin/
240- - run : chmod +x ~/.cargo/bin/cargo- dist
233+ - run : chmod +x ~/.cargo/bin/dist
241234 # Fetch artifacts from scratch-storage
242235 - name : Fetch artifacts
243236 uses : actions/download-artifact@v4
@@ -248,7 +241,7 @@ jobs:
248241 - id : host
249242 shell : bash
250243 run : |
251- cargo dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
244+ dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
252245 echo "artifacts uploaded and released successfully"
253246 cat dist-manifest.json
254247 echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
@@ -289,7 +282,7 @@ jobs:
289282 # still allowing individual publish jobs to skip themselves (for prereleases).
290283 # "host" however must run to completion, no skipping allowed!
291284 if : ${{ always() && needs.host.result == 'success' }}
292- runs-on : " ubuntu-latest "
285+ runs-on : " ubuntu-20.04 "
293286 env :
294287 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
295288 steps :
0 commit comments