1212# title/body based on your changelogs.
1313
1414name : Release
15-
1615permissions :
17- contents : write
16+ " contents " : " write"
1817
1918# This task will run whenever you push a git tag that looks like a version
2019# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc.
@@ -38,23 +37,22 @@ permissions:
3837# If there's a prerelease-style suffix to the version, then the release(s)
3938# will be marked as a prerelease.
4039on :
40+ pull_request :
4141 push :
4242 tags :
4343 - ' libsql-server**[0-9]+.[0-9]+.[0-9]+*'
44- pull_request :
4544
4645jobs :
4746 # Run 'cargo dist plan' (or host) to determine what tasks we need to do
4847 plan :
49- runs-on : ubuntu-latest
48+ runs-on : " ubuntu-20.04 "
5049 outputs :
5150 val : ${{ steps.plan.outputs.manifest }}
5251 tag : ${{ !github.event.pull_request && github.ref_name || '' }}
5352 tag-flag : ${{ !github.event.pull_request && format('--tag={0}', github.ref_name) || '' }}
5453 publishing : ${{ !github.event.pull_request }}
5554 env :
5655 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
57- RUSTFLAGS : --cfg tokio_unstable
5856 steps :
5957 - uses : actions/checkout@v4
6058 with :
6361 # we specify bash to get pipefail; it guards against the `curl` command
6462 # failing. otherwise `sh` won't catch that `curl` returned non-0
6563 shell : bash
66- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh"
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
66+ uses : actions/upload-artifact@v4
67+ with :
68+ name : cargo-dist-cache
69+ path : ~/.cargo/bin/cargo-dist
6770 # sure would be cool if github gave us proper conditionals...
6871 # so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
6972 # functionality based on whether this is a pull_request, and whether it's from a fork.
@@ -105,17 +108,16 @@ jobs:
105108 env :
106109 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
107110 BUILD_MANIFEST_NAME : target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
108- RUSTFLAGS : --cfg tokio_unstable
109111 steps :
110112 - name : enable windows longpaths
111113 run : |
112114 git config --global core.longpaths true
113115 - uses : actions/checkout@v4
114116 with :
115117 submodules : recursive
116- - uses : swatinem/rust-cache@v2
117- with :
118- key : ${{ join(matrix.targets, '-') }}
118+ - name : " Prepare env vars "
119+ env :
120+ " RUSTFLAGS " : " --cfg tokio_unstable "
119121 - name : Install cargo-dist
120122 run : ${{ matrix.install_dist }}
121123 # Get the dist-manifest
@@ -163,14 +165,16 @@ jobs:
163165 env :
164166 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
165167 BUILD_MANIFEST_NAME : target/distrib/global-dist-manifest.json
166- RUSTFLAGS : --cfg tokio_unstable
167168 steps :
168169 - uses : actions/checkout@v4
169170 with :
170171 submodules : recursive
171- - name : Install cargo-dist
172- shell : bash
173- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh"
172+ - name : Install cached cargo-dist
173+ uses : actions/download-artifact@v4
174+ with :
175+ name : cargo-dist-cache
176+ path : ~/.cargo/bin/
177+ - run : chmod +x ~/.cargo/bin/cargo-dist
174178 # Get all the local artifacts for the global tasks to use (for e.g. checksums)
175179 - name : Fetch local artifacts
176180 uses : actions/download-artifact@v4
@@ -207,24 +211,26 @@ jobs:
207211 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') }}
208212 env :
209213 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
210- RUSTFLAGS : --cfg tokio_unstable
211214 runs-on : " ubuntu-20.04"
212215 outputs :
213216 val : ${{ steps.host.outputs.manifest }}
214217 steps :
215218 - uses : actions/checkout@v4
216219 with :
217220 submodules : recursive
218- - name : Install cargo-dist
219- run : " curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh"
221+ - name : Install cached cargo-dist
222+ uses : actions/download-artifact@v4
223+ with :
224+ name : cargo-dist-cache
225+ path : ~/.cargo/bin/
226+ - run : chmod +x ~/.cargo/bin/cargo-dist
220227 # Fetch artifacts from scratch-storage
221228 - name : Fetch artifacts
222229 uses : actions/download-artifact@v4
223230 with :
224231 pattern : artifacts-*
225232 path : target/distrib/
226233 merge-multiple : true
227- # This is a harmless no-op for GitHub Releases, hosting for that happens in "announce"
228234 - id : host
229235 shell : bash
230236 run : |
@@ -238,6 +244,28 @@ jobs:
238244 # Overwrite the previous copy
239245 name : artifacts-dist-manifest
240246 path : dist-manifest.json
247+ # Create a GitHub Release while uploading all files to it
248+ - name : " Download GitHub Artifacts"
249+ uses : actions/download-artifact@v4
250+ with :
251+ pattern : artifacts-*
252+ path : artifacts
253+ merge-multiple : true
254+ - name : Cleanup
255+ run : |
256+ # Remove the granular manifests
257+ rm -f artifacts/*-dist-manifest.json
258+ - name : Create GitHub Release
259+ env :
260+ PRERELEASE_FLAG : " ${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}"
261+ ANNOUNCEMENT_TITLE : " ${{ fromJson(steps.host.outputs.manifest).announcement_title }}"
262+ ANNOUNCEMENT_BODY : " ${{ fromJson(steps.host.outputs.manifest).announcement_github_body }}"
263+ RELEASE_COMMIT : " ${{ github.sha }}"
264+ run : |
265+ # Write and read notes from a file to avoid quoting breaking things
266+ echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt
267+
268+ gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
241269
242270 publish-homebrew-formula :
243271 needs :
@@ -279,7 +307,6 @@ jobs:
279307 done
280308 git push
281309
282- # Create a GitHub Release while uploading all files to it
283310 announce :
284311 needs :
285312 - plan
@@ -296,21 +323,3 @@ jobs:
296323 - uses : actions/checkout@v4
297324 with :
298325 submodules : recursive
299- - name : " Download GitHub Artifacts"
300- uses : actions/download-artifact@v4
301- with :
302- pattern : artifacts-*
303- path : artifacts
304- merge-multiple : true
305- - name : Cleanup
306- run : |
307- # Remove the granular manifests
308- rm -f artifacts/*-dist-manifest.json
309- - name : Create GitHub Release
310- uses : ncipollo/release-action@v1
311- with :
312- tag : ${{ needs.plan.outputs.tag }}
313- name : ${{ fromJson(needs.host.outputs.val).announcement_title }}
314- body : ${{ fromJson(needs.host.outputs.val).announcement_github_body }}
315- prerelease : ${{ fromJson(needs.host.outputs.val).announcement_is_prerelease }}
316- artifacts : " artifacts/*"
0 commit comments