12
12
# title/body based on your changelogs.
13
13
14
14
name : Release
15
-
16
15
permissions :
17
- contents : write
16
+ " contents " : " write"
18
17
19
18
# This task will run whenever you push a git tag that looks like a version
20
19
# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc.
@@ -38,15 +37,15 @@ permissions:
38
37
# If there's a prerelease-style suffix to the version, then the release(s)
39
38
# will be marked as a prerelease.
40
39
on :
40
+ pull_request :
41
41
push :
42
42
tags :
43
43
- ' **[0-9]+.[0-9]+.[0-9]+*'
44
- pull_request :
45
44
46
45
jobs :
47
46
# Run 'cargo dist plan' (or host) to determine what tasks we need to do
48
47
plan :
49
- runs-on : ubuntu-latest
48
+ runs-on : " ubuntu-20.04 "
50
49
outputs :
51
50
val : ${{ steps.plan.outputs.manifest }}
52
51
tag : ${{ !github.event.pull_request && github.ref_name || '' }}
62
61
# we specify bash to get pipefail; it guards against the `curl` command
63
62
# failing. otherwise `sh` won't catch that `curl` returned non-0
64
63
shell : bash
65
- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.13.2/cargo-dist-installer.sh | sh"
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
+ uses : actions/upload-artifact@v4
67
+ with :
68
+ name : cargo-dist-cache
69
+ path : ~/.cargo/bin/cargo-dist
66
70
# sure would be cool if github gave us proper conditionals...
67
71
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
68
72
# functionality based on whether this is a pull_request, and whether it's from a fork.
@@ -105,12 +109,12 @@ jobs:
105
109
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
106
110
BUILD_MANIFEST_NAME : target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
107
111
steps :
112
+ - name : enable windows longpaths
113
+ run : |
114
+ git config --global core.longpaths true
108
115
- uses : actions/checkout@v4
109
116
with :
110
117
submodules : recursive
111
- - uses : swatinem/rust-cache@v2
112
- with :
113
- key : ${{ join(matrix.targets, '-') }}
114
118
- name : Install cargo-dist
115
119
run : ${{ matrix.install_dist }}
116
120
# Get the dist-manifest
@@ -162,9 +166,12 @@ jobs:
162
166
- uses : actions/checkout@v4
163
167
with :
164
168
submodules : recursive
165
- - name : Install cargo-dist
166
- shell : bash
167
- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.13.2/cargo-dist-installer.sh | sh"
169
+ - name : Install cached cargo-dist
170
+ uses : actions/download-artifact@v4
171
+ with :
172
+ name : cargo-dist-cache
173
+ path : ~/.cargo/bin/
174
+ - run : chmod +x ~/.cargo/bin/cargo-dist
168
175
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
169
176
- name : Fetch local artifacts
170
177
uses : actions/download-artifact@v4
@@ -208,16 +215,19 @@ jobs:
208
215
- uses : actions/checkout@v4
209
216
with :
210
217
submodules : recursive
211
- - name : Install cargo-dist
212
- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.13.2/cargo-dist-installer.sh | sh"
218
+ - name : Install cached cargo-dist
219
+ uses : actions/download-artifact@v4
220
+ with :
221
+ name : cargo-dist-cache
222
+ path : ~/.cargo/bin/
223
+ - run : chmod +x ~/.cargo/bin/cargo-dist
213
224
# Fetch artifacts from scratch-storage
214
225
- name : Fetch artifacts
215
226
uses : actions/download-artifact@v4
216
227
with :
217
228
pattern : artifacts-*
218
229
path : target/distrib/
219
230
merge-multiple : true
220
- # This is a harmless no-op for GitHub Releases, hosting for that happens in "announce"
221
231
- id : host
222
232
shell : bash
223
233
run : |
@@ -231,8 +241,29 @@ jobs:
231
241
# Overwrite the previous copy
232
242
name : artifacts-dist-manifest
233
243
path : dist-manifest.json
244
+ # Create a GitHub Release while uploading all files to it
245
+ - name : " Download GitHub Artifacts"
246
+ uses : actions/download-artifact@v4
247
+ with :
248
+ pattern : artifacts-*
249
+ path : artifacts
250
+ merge-multiple : true
251
+ - name : Cleanup
252
+ run : |
253
+ # Remove the granular manifests
254
+ rm -f artifacts/*-dist-manifest.json
255
+ - name : Create GitHub Release
256
+ env :
257
+ PRERELEASE_FLAG : " ${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}"
258
+ ANNOUNCEMENT_TITLE : " ${{ fromJson(steps.host.outputs.manifest).announcement_title }}"
259
+ ANNOUNCEMENT_BODY : " ${{ fromJson(steps.host.outputs.manifest).announcement_github_body }}"
260
+ RELEASE_COMMIT : " ${{ github.sha }}"
261
+ run : |
262
+ # Write and read notes from a file to avoid quoting breaking things
263
+ echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt
264
+
265
+ gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
234
266
235
- # Create a GitHub Release while uploading all files to it
236
267
announce :
237
268
needs :
238
269
- plan
@@ -248,21 +279,3 @@ jobs:
248
279
- uses : actions/checkout@v4
249
280
with :
250
281
submodules : recursive
251
- - name : " Download GitHub Artifacts"
252
- uses : actions/download-artifact@v4
253
- with :
254
- pattern : artifacts-*
255
- path : artifacts
256
- merge-multiple : true
257
- - name : Cleanup
258
- run : |
259
- # Remove the granular manifests
260
- rm -f artifacts/*-dist-manifest.json
261
- - name : Create GitHub Release
262
- uses : ncipollo/release-action@v1
263
- with :
264
- tag : ${{ needs.plan.outputs.tag }}
265
- name : ${{ fromJson(needs.host.outputs.val).announcement_title }}
266
- body : ${{ fromJson(needs.host.outputs.val).announcement_github_body }}
267
- prerelease : ${{ fromJson(needs.host.outputs.val).announcement_is_prerelease }}
268
- artifacts : " artifacts/*"
0 commit comments