1- # This file was autogenerated by cargo- dist: https://opensource.axo.dev/cargo-dist/
1+ # This file was autogenerated by dist: https://opensource.axo.dev/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 :
5050 runs-on : " ubuntu-22.04"
5151 outputs :
@@ -59,25 +59,25 @@ jobs:
5959 - uses : actions/checkout@v4
6060 with :
6161 submodules : recursive
62- - name : Install cargo- dist
62+ - name : Install dist
6363 # we specify bash to get pipefail; it guards against the `curl` command
6464 # failing. otherwise `sh` won't catch that `curl` returned non-0
6565 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
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
6868 uses : actions/upload-artifact@v4
6969 with :
7070 name : cargo-dist-cache
71- path : ~/.cargo/bin/cargo- dist
71+ path : ~/.cargo/bin/dist
7272 # sure would be cool if github gave us proper conditionals...
7373 # so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
7474 # functionality based on whether this is a pull_request, and whether it's from a fork.
7575 # (PRs run on the *source* but secrets are usually on the *target* -- that's *good*
7676 # but also really annoying to build CI around when it needs secrets to work right.)
7777 - id : plan
7878 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"
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"
8181 cat plan-dist-manifest.json
8282 echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
8383 - name : " Upload dist-manifest.json"
@@ -95,18 +95,19 @@ jobs:
9595 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') }}
9696 strategy :
9797 fail-fast : false
98- # Target platforms/runners are computed by cargo- dist in create-release.
98+ # Target platforms/runners are computed by dist in create-release.
9999 # Each member of the matrix has the following arguments:
100100 #
101101 # - 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
102+ # - dist-args: cli flags to pass to dist
103+ # - install-dist: expression to run to install dist on the runner
104104 #
105105 # Typically there will be:
106106 # - 1 "global" task that builds universal installers
107107 # - N "local" tasks that build each platform's binaries and platform-specific installers
108108 matrix : ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }}
109109 runs-on : ${{ matrix.runner }}
110+ container : ${{ matrix.container && matrix.container.image || null }}
110111 env :
111112 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
112113 BUILD_MANIFEST_NAME : target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
@@ -117,8 +118,15 @@ jobs:
117118 - uses : actions/checkout@v4
118119 with :
119120 submodules : recursive
120- - name : Install cargo-dist
121- 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 }}
122130 # Get the dist-manifest
123131 - name : Fetch local artifacts
124132 uses : actions/download-artifact@v4
@@ -132,8 +140,8 @@ jobs:
132140 - name : Build artifacts
133141 run : |
134142 # 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"
143+ dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
144+ echo "dist ran successfully"
137145 - id : cargo-dist
138146 name : Post-build
139147 # We force bash here just because github makes it really hard to get values up
@@ -143,7 +151,7 @@ jobs:
143151 run : |
144152 # Parse out what we just built and upload it to scratch storage
145153 echo "paths<<EOF" >> "$GITHUB_OUTPUT"
146- jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
154+ dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"
147155 echo "EOF" >> "$GITHUB_OUTPUT"
148156
149157 cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -168,12 +176,12 @@ jobs:
168176 - uses : actions/checkout@v4
169177 with :
170178 submodules : recursive
171- - name : Install cached cargo- dist
179+ - name : Install cached dist
172180 uses : actions/download-artifact@v4
173181 with :
174182 name : cargo-dist-cache
175183 path : ~/.cargo/bin/
176- - run : chmod +x ~/.cargo/bin/cargo- dist
184+ - run : chmod +x ~/.cargo/bin/dist
177185 # Get all the local artifacts for the global tasks to use (for e.g. checksums)
178186 - name : Fetch local artifacts
179187 uses : actions/download-artifact@v4
@@ -184,8 +192,8 @@ jobs:
184192 - id : cargo-dist
185193 shell : bash
186194 run : |
187- cargo dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
188- 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"
189197
190198 # Parse out what we just built and upload it to scratch storage
191199 echo "paths<<EOF" >> "$GITHUB_OUTPUT"
@@ -217,12 +225,12 @@ jobs:
217225 - uses : actions/checkout@v4
218226 with :
219227 submodules : recursive
220- - name : Install cached cargo- dist
228+ - name : Install cached dist
221229 uses : actions/download-artifact@v4
222230 with :
223231 name : cargo-dist-cache
224232 path : ~/.cargo/bin/
225- - run : chmod +x ~/.cargo/bin/cargo- dist
233+ - run : chmod +x ~/.cargo/bin/dist
226234 # Fetch artifacts from scratch-storage
227235 - name : Fetch artifacts
228236 uses : actions/download-artifact@v4
@@ -233,7 +241,7 @@ jobs:
233241 - id : host
234242 shell : bash
235243 run : |
236- 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
237245 echo "artifacts uploaded and released successfully"
238246 cat dist-manifest.json
239247 echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
0 commit comments