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