1
- # This file was autogenerated by cargo- dist: https://opensource.axo.dev/ cargo-dist/
1
+ # This file was autogenerated by dist: https://github.com/astral-sh/ cargo-dist
2
2
#
3
3
# Copyright 2022-2024, axodotdev
4
+ # Copyright 2025 Astral Software Inc.
4
5
# SPDX-License-Identifier: MIT or Apache-2.0
5
6
#
6
7
# CI that:
7
8
#
8
9
# * checks for a Git Tag that looks like a release
9
- # * builds artifacts with cargo- dist (archives, installers, hashes)
10
+ # * builds artifacts with dist (archives, installers, hashes)
10
11
# * uploads those artifacts to temporary workflow zip
11
12
# * on success, uploads the artifacts to a GitHub Release
12
13
#
@@ -24,10 +25,10 @@ permissions:
24
25
# must be a Cargo-style SemVer Version (must have at least major.minor.patch).
25
26
#
26
27
# 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).
28
+ # package (erroring out if it doesn't have the given version or isn't dist-able).
28
29
#
29
30
# 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
31
+ # (dist-able) packages in the workspace with that version (this mode is
31
32
# intended for workspaces with only one dist-able package, or with all dist-able
32
33
# packages versioned/released in lockstep).
33
34
#
45
46
- ' **[0-9]+.[0-9]+.[0-9]+*'
46
47
47
48
jobs :
48
- # Run 'cargo dist plan' (or host) to determine what tasks we need to do
49
+ # Run 'dist plan' (or host) to determine what tasks we need to do
49
50
plan :
50
- runs-on : " ubuntu-20 .04"
51
+ runs-on : " ubuntu-22 .04"
51
52
outputs :
52
53
val : ${{ steps.plan.outputs.manifest }}
53
54
tag : ${{ !github.event.pull_request && github.ref_name || '' }}
@@ -58,26 +59,27 @@ jobs:
58
59
steps :
59
60
- uses : actions/checkout@v4
60
61
with :
62
+ persist-credentials : false
61
63
submodules : recursive
62
- - name : Install cargo- dist
64
+ - name : Install dist
63
65
# we specify bash to get pipefail; it guards against the `curl` command
64
66
# failing. otherwise `sh` won't catch that `curl` returned non-0
65
67
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
68
+ run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh /cargo-dist/releases/download/v0.28.4 /cargo-dist-installer.sh | sh"
69
+ - name : Cache dist
68
70
uses : actions/upload-artifact@v4
69
71
with :
70
72
name : cargo-dist-cache
71
- path : ~/.cargo/bin/cargo- dist
73
+ path : ~/.cargo/bin/dist
72
74
# sure would be cool if github gave us proper conditionals...
73
75
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
74
76
# functionality based on whether this is a pull_request, and whether it's from a fork.
75
77
# (PRs run on the *source* but secrets are usually on the *target* -- that's *good*
76
78
# but also really annoying to build CI around when it needs secrets to work right.)
77
79
- id : plan
78
80
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"
81
+ dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
82
+ echo "dist ran successfully"
81
83
cat plan-dist-manifest.json
82
84
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
83
85
- name : " Upload dist-manifest.json"
@@ -95,18 +97,19 @@ jobs:
95
97
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') }}
96
98
strategy :
97
99
fail-fast : false
98
- # Target platforms/runners are computed by cargo- dist in create-release.
100
+ # Target platforms/runners are computed by dist in create-release.
99
101
# Each member of the matrix has the following arguments:
100
102
#
101
103
# - 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
104
+ # - dist-args: cli flags to pass to dist
105
+ # - install-dist: expression to run to install dist on the runner
104
106
#
105
107
# Typically there will be:
106
108
# - 1 "global" task that builds universal installers
107
109
# - N "local" tasks that build each platform's binaries and platform-specific installers
108
110
matrix : ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }}
109
111
runs-on : ${{ matrix.runner }}
112
+ container : ${{ matrix.container && matrix.container.image || null }}
110
113
env :
111
114
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
112
115
BUILD_MANIFEST_NAME : target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
@@ -116,9 +119,17 @@ jobs:
116
119
git config --global core.longpaths true
117
120
- uses : actions/checkout@v4
118
121
with :
122
+ persist-credentials : false
119
123
submodules : recursive
120
- - name : Install cargo-dist
121
- run : ${{ matrix.install_dist }}
124
+ - name : Install Rust non-interactively if not already installed
125
+ if : ${{ matrix.container }}
126
+ run : |
127
+ if ! command -v cargo > /dev/null 2>&1; then
128
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
129
+ echo "$HOME/.cargo/bin" >> $GITHUB_PATH
130
+ fi
131
+ - name : Install dist
132
+ run : ${{ matrix.install_dist.run }}
122
133
# Get the dist-manifest
123
134
- name : Fetch local artifacts
124
135
uses : actions/download-artifact@v4
@@ -132,8 +143,8 @@ jobs:
132
143
- name : Build artifacts
133
144
run : |
134
145
# 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"
146
+ dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
147
+ echo "dist ran successfully"
137
148
- id : cargo-dist
138
149
name : Post-build
139
150
# We force bash here just because github makes it really hard to get values up
@@ -143,7 +154,7 @@ jobs:
143
154
run : |
144
155
# Parse out what we just built and upload it to scratch storage
145
156
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
146
- jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
157
+ dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"
147
158
echo "EOF" >> "$GITHUB_OUTPUT"
148
159
149
160
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -160,20 +171,21 @@ jobs:
160
171
needs :
161
172
- plan
162
173
- build-local-artifacts
163
- runs-on : " ubuntu-20 .04"
174
+ runs-on : " ubuntu-22 .04"
164
175
env :
165
176
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
166
177
BUILD_MANIFEST_NAME : target/distrib/global-dist-manifest.json
167
178
steps :
168
179
- uses : actions/checkout@v4
169
180
with :
181
+ persist-credentials : false
170
182
submodules : recursive
171
- - name : Install cached cargo- dist
183
+ - name : Install cached dist
172
184
uses : actions/download-artifact@v4
173
185
with :
174
186
name : cargo-dist-cache
175
187
path : ~/.cargo/bin/
176
- - run : chmod +x ~/.cargo/bin/cargo- dist
188
+ - run : chmod +x ~/.cargo/bin/dist
177
189
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
178
190
- name : Fetch local artifacts
179
191
uses : actions/download-artifact@v4
@@ -184,8 +196,8 @@ jobs:
184
196
- id : cargo-dist
185
197
shell : bash
186
198
run : |
187
- cargo dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
188
- echo "cargo dist ran successfully"
199
+ dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
200
+ echo "dist ran successfully"
189
201
190
202
# Parse out what we just built and upload it to scratch storage
191
203
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
@@ -210,19 +222,20 @@ jobs:
210
222
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') }}
211
223
env :
212
224
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
213
- runs-on : " ubuntu-20 .04"
225
+ runs-on : " ubuntu-22 .04"
214
226
outputs :
215
227
val : ${{ steps.host.outputs.manifest }}
216
228
steps :
217
229
- uses : actions/checkout@v4
218
230
with :
231
+ persist-credentials : false
219
232
submodules : recursive
220
- - name : Install cached cargo- dist
233
+ - name : Install cached dist
221
234
uses : actions/download-artifact@v4
222
235
with :
223
236
name : cargo-dist-cache
224
237
path : ~/.cargo/bin/
225
- - run : chmod +x ~/.cargo/bin/cargo- dist
238
+ - run : chmod +x ~/.cargo/bin/dist
226
239
# Fetch artifacts from scratch-storage
227
240
- name : Fetch artifacts
228
241
uses : actions/download-artifact@v4
@@ -233,7 +246,7 @@ jobs:
233
246
- id : host
234
247
shell : bash
235
248
run : |
236
- cargo dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
249
+ dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
237
250
echo "artifacts uploaded and released successfully"
238
251
cat dist-manifest.json
239
252
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
@@ -274,10 +287,11 @@ jobs:
274
287
# still allowing individual publish jobs to skip themselves (for prereleases).
275
288
# "host" however must run to completion, no skipping allowed!
276
289
if : ${{ always() && needs.host.result == 'success' }}
277
- runs-on : " ubuntu-20 .04"
290
+ runs-on : " ubuntu-22 .04"
278
291
env :
279
292
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
280
293
steps :
281
294
- uses : actions/checkout@v4
282
295
with :
296
+ persist-credentials : false
283
297
submodules : recursive
0 commit comments