1+ # This file was autogenerated by dist: https://axodotdev.github.io/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 "
50+ runs-on : " ubuntu-22.04 "
4951 outputs :
5052 val : ${{ steps.plan.outputs.manifest }}
5153 tag : ${{ !github.event.pull_request && github.ref_name || '' }}
@@ -56,26 +58,27 @@ jobs:
5658 steps :
5759 - uses : actions/checkout@v4
5860 with :
61+ persist-credentials : false
5962 submodules : recursive
60- - name : Install cargo- dist
63+ - name : Install dist
6164 # we specify bash to get pipefail; it guards against the `curl` command
6265 # failing. otherwise `sh` won't catch that `curl` returned non-0
6366 shell : bash
64- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.21.0 /cargo-dist-installer.sh | sh"
65- - 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
6669 uses : actions/upload-artifact@v4
6770 with :
6871 name : cargo-dist-cache
69- path : ~/.cargo/bin/cargo- dist
72+ path : ~/.cargo/bin/dist
7073 # sure would be cool if github gave us proper conditionals...
7174 # so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
7275 # functionality based on whether this is a pull_request, and whether it's from a fork.
7376 # (PRs run on the *source* but secrets are usually on the *target* -- that's *good*
7477 # but also really annoying to build CI around when it needs secrets to work right.)
7578 - id : plan
7679 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"
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"
7982 cat plan-dist-manifest.json
8083 echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
8184 - name : " Upload dist-manifest.json"
@@ -93,18 +96,19 @@ jobs:
9396 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') }}
9497 strategy :
9598 fail-fast : false
96- # Target platforms/runners are computed by cargo- dist in create-release.
99+ # Target platforms/runners are computed by dist in create-release.
97100 # Each member of the matrix has the following arguments:
98101 #
99102 # - 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
103+ # - dist-args: cli flags to pass to dist
104+ # - install-dist: expression to run to install dist on the runner
102105 #
103106 # Typically there will be:
104107 # - 1 "global" task that builds universal installers
105108 # - N "local" tasks that build each platform's binaries and platform-specific installers
106109 matrix : ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }}
107110 runs-on : ${{ matrix.runner }}
111+ container : ${{ matrix.container && matrix.container.image || null }}
108112 env :
109113 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
110114 BUILD_MANIFEST_NAME : target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
@@ -114,9 +118,17 @@ jobs:
114118 git config --global core.longpaths true
115119 - uses : actions/checkout@v4
116120 with :
121+ persist-credentials : false
117122 submodules : recursive
118- - name : Install cargo-dist
119- 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 }}
120132 # Get the dist-manifest
121133 - name : Fetch local artifacts
122134 uses : actions/download-artifact@v4
@@ -130,8 +142,8 @@ jobs:
130142 - name : Build artifacts
131143 run : |
132144 # 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"
145+ dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
146+ echo "dist ran successfully"
135147 - id : cargo-dist
136148 name : Post-build
137149 # We force bash here just because github makes it really hard to get values up
@@ -141,7 +153,7 @@ jobs:
141153 run : |
142154 # Parse out what we just built and upload it to scratch storage
143155 echo "paths<<EOF" >> "$GITHUB_OUTPUT"
144- jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
156+ dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"
145157 echo "EOF" >> "$GITHUB_OUTPUT"
146158
147159 cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -158,20 +170,21 @@ jobs:
158170 needs :
159171 - plan
160172 - build-local-artifacts
161- runs-on : " ubuntu-latest "
173+ runs-on : " ubuntu-22.04 "
162174 env :
163175 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
164176 BUILD_MANIFEST_NAME : target/distrib/global-dist-manifest.json
165177 steps :
166178 - uses : actions/checkout@v4
167179 with :
180+ persist-credentials : false
168181 submodules : recursive
169- - name : Install cached cargo- dist
182+ - name : Install cached dist
170183 uses : actions/download-artifact@v4
171184 with :
172185 name : cargo-dist-cache
173186 path : ~/.cargo/bin/
174- - run : chmod +x ~/.cargo/bin/cargo- dist
187+ - run : chmod +x ~/.cargo/bin/dist
175188 # Get all the local artifacts for the global tasks to use (for e.g. checksums)
176189 - name : Fetch local artifacts
177190 uses : actions/download-artifact@v4
@@ -182,8 +195,8 @@ jobs:
182195 - id : cargo-dist
183196 shell : bash
184197 run : |
185- cargo dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
186- 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"
187200
188201 # Parse out what we just built and upload it to scratch storage
189202 echo "paths<<EOF" >> "$GITHUB_OUTPUT"
@@ -204,23 +217,24 @@ jobs:
204217 - plan
205218 - build-local-artifacts
206219 - build-global-artifacts
207- # Only run if we're "publishing", and only if local and global didn't fail (skipped is fine)
208- 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') }}
209222 env :
210223 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
211- runs-on : " ubuntu-latest "
224+ runs-on : " ubuntu-22.04 "
212225 outputs :
213226 val : ${{ steps.host.outputs.manifest }}
214227 steps :
215228 - uses : actions/checkout@v4
216229 with :
230+ persist-credentials : false
217231 submodules : recursive
218- - name : Install cached cargo- dist
232+ - name : Install cached dist
219233 uses : actions/download-artifact@v4
220234 with :
221235 name : cargo-dist-cache
222236 path : ~/.cargo/bin/
223- - run : chmod +x ~/.cargo/bin/cargo- dist
237+ - run : chmod +x ~/.cargo/bin/dist
224238 # Fetch artifacts from scratch-storage
225239 - name : Fetch artifacts
226240 uses : actions/download-artifact@v4
@@ -231,7 +245,7 @@ jobs:
231245 - id : host
232246 shell : bash
233247 run : |
234- 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
235249 echo "artifacts uploaded and released successfully"
236250 cat dist-manifest.json
237251 echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
@@ -272,10 +286,11 @@ jobs:
272286 # still allowing individual publish jobs to skip themselves (for prereleases).
273287 # "host" however must run to completion, no skipping allowed!
274288 if : ${{ always() && needs.host.result == 'success' }}
275- runs-on : " ubuntu-latest "
289+ runs-on : " ubuntu-22.04 "
276290 env :
277291 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
278292 steps :
279293 - uses : actions/checkout@v4
280294 with :
295+ persist-credentials : false
281296 submodules : recursive
0 commit comments