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/
2
2
#
3
3
# Copyright 2022-2024, axodotdev
4
4
# SPDX-License-Identifier: MIT or Apache-2.0
5
5
#
6
6
# CI that:
7
7
#
8
8
# * 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)
10
10
# * uploads those artifacts to temporary workflow zip
11
11
# * on success, uploads the artifacts to a GitHub Release
12
12
#
@@ -24,10 +24,10 @@ permissions:
24
24
# must be a Cargo-style SemVer Version (must have at least major.minor.patch).
25
25
#
26
26
# 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).
28
28
#
29
29
# 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
31
31
# intended for workspaces with only one dist-able package, or with all dist-able
32
32
# packages versioned/released in lockstep).
33
33
#
45
45
- ' **[0-9]+.[0-9]+.[0-9]+*'
46
46
47
47
jobs :
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
49
49
plan :
50
50
runs-on : " ubuntu-20.04"
51
51
outputs :
@@ -59,25 +59,25 @@ jobs:
59
59
- uses : actions/checkout@v4
60
60
with :
61
61
submodules : recursive
62
- - name : Install cargo- dist
62
+ - name : Install dist
63
63
# we specify bash to get pipefail; it guards against the `curl` command
64
64
# failing. otherwise `sh` won't catch that `curl` returned non-0
65
65
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
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
68
68
uses : actions/upload-artifact@v4
69
69
with :
70
70
name : cargo-dist-cache
71
- path : ~/.cargo/bin/cargo- dist
71
+ path : ~/.cargo/bin/dist
72
72
# sure would be cool if github gave us proper conditionals...
73
73
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
74
74
# functionality based on whether this is a pull_request, and whether it's from a fork.
75
75
# (PRs run on the *source* but secrets are usually on the *target* -- that's *good*
76
76
# but also really annoying to build CI around when it needs secrets to work right.)
77
77
- id : plan
78
78
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"
81
81
cat plan-dist-manifest.json
82
82
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
83
83
- name : " Upload dist-manifest.json"
@@ -95,18 +95,19 @@ jobs:
95
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') }}
96
96
strategy :
97
97
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.
99
99
# Each member of the matrix has the following arguments:
100
100
#
101
101
# - 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
104
104
#
105
105
# Typically there will be:
106
106
# - 1 "global" task that builds universal installers
107
107
# - N "local" tasks that build each platform's binaries and platform-specific installers
108
108
matrix : ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }}
109
109
runs-on : ${{ matrix.runner }}
110
+ container : ${{ matrix.container && matrix.container.image || null }}
110
111
env :
111
112
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
112
113
BUILD_MANIFEST_NAME : target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
@@ -117,8 +118,15 @@ jobs:
117
118
- uses : actions/checkout@v4
118
119
with :
119
120
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 }}
122
130
# Get the dist-manifest
123
131
- name : Fetch local artifacts
124
132
uses : actions/download-artifact@v4
@@ -132,8 +140,8 @@ jobs:
132
140
- name : Build artifacts
133
141
run : |
134
142
# 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"
137
145
- id : cargo-dist
138
146
name : Post-build
139
147
# We force bash here just because github makes it really hard to get values up
@@ -143,7 +151,7 @@ jobs:
143
151
run : |
144
152
# Parse out what we just built and upload it to scratch storage
145
153
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"
147
155
echo "EOF" >> "$GITHUB_OUTPUT"
148
156
149
157
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -168,12 +176,12 @@ jobs:
168
176
- uses : actions/checkout@v4
169
177
with :
170
178
submodules : recursive
171
- - name : Install cached cargo- dist
179
+ - name : Install cached dist
172
180
uses : actions/download-artifact@v4
173
181
with :
174
182
name : cargo-dist-cache
175
183
path : ~/.cargo/bin/
176
- - run : chmod +x ~/.cargo/bin/cargo- dist
184
+ - run : chmod +x ~/.cargo/bin/dist
177
185
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
178
186
- name : Fetch local artifacts
179
187
uses : actions/download-artifact@v4
@@ -184,8 +192,8 @@ jobs:
184
192
- id : cargo-dist
185
193
shell : bash
186
194
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"
189
197
190
198
# Parse out what we just built and upload it to scratch storage
191
199
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
@@ -217,12 +225,12 @@ jobs:
217
225
- uses : actions/checkout@v4
218
226
with :
219
227
submodules : recursive
220
- - name : Install cached cargo- dist
228
+ - name : Install cached dist
221
229
uses : actions/download-artifact@v4
222
230
with :
223
231
name : cargo-dist-cache
224
232
path : ~/.cargo/bin/
225
- - run : chmod +x ~/.cargo/bin/cargo- dist
233
+ - run : chmod +x ~/.cargo/bin/dist
226
234
# Fetch artifacts from scratch-storage
227
235
- name : Fetch artifacts
228
236
uses : actions/download-artifact@v4
@@ -233,7 +241,7 @@ jobs:
233
241
- id : host
234
242
shell : bash
235
243
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
237
245
echo "artifacts uploaded and released successfully"
238
246
cat dist-manifest.json
239
247
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
0 commit comments