Skip to content

Commit 8a37813

Browse files
committed
upgrade cargo dist 0.14.1 -> 0.21.0 in order to use "github-build-setup" setting
1 parent 3abd43a commit 8a37813

3 files changed

Lines changed: 55 additions & 39 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- name: Prepare env vars
2+
env:
3+
RUSTFLAGS: --cfg tokio_unstable

.github/workflows/libsql-server-release.yml

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
# title/body based on your changelogs.
1313

1414
name: Release
15-
1615
permissions:
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.
4039
on:
40+
pull_request:
4141
push:
4242
tags:
4343
- 'libsql-server**[0-9]+.[0-9]+.[0-9]+*'
44-
pull_request:
4544

4645
jobs:
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:
@@ -63,7 +61,12 @@ jobs:
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/*"

Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ zerocopy = { version = "0.7.32", features = ["derive", "alloc"] }
5050
# Config for 'cargo dist'
5151
[workspace.metadata.dist]
5252
# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
53-
cargo-dist-version = "0.14.1"
53+
cargo-dist-version = "0.21.0"
5454
# CI backends to support
5555
ci = "github"
5656
# The installers to generate for each app
@@ -65,12 +65,16 @@ targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-apple-da
6565
publish-jobs = ["homebrew"]
6666
# Whether cargo-dist should create a Github Release or use an existing draft
6767
create-release = true
68-
# Publish jobs to run in CI
68+
# Which actions to run on pull requests
6969
pr-run-mode = "plan"
7070
# A prefix git tags must include for cargo-dist to care about them
7171
tag-namespace = "libsql-server"
7272
# Whether to install an updater program
7373
install-updater = false
74+
# additional setup steps
75+
github-build-setup = "libsql-server-release-build-setup.yml"
76+
# Path that installers should place binaries in
77+
install-path = "CARGO_HOME"
7478

7579
[workspace.metadata.dist.github-custom-runners]
7680
aarch64-apple-darwin = "macos-14"

0 commit comments

Comments
 (0)