Skip to content

Commit 0c19b79

Browse files
authored
Merge pull request #1674 from tursodatabase/fix-libsql-publish-action
set RUSTFLAGS for cargo dist in libsql-server-release GA
2 parents 4f72593 + 3554406 commit 0c19b79

4 files changed

Lines changed: 54 additions & 35 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- name: Prepare env vars
2+
run: echo "RUSTFLAGS=--cfg tokio_unstable" >> $GITHUB_ENV

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

Lines changed: 45 additions & 33 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,15 +37,15 @@ 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 || '' }}
@@ -62,7 +61,12 @@ jobs:
6261
# we specify bash to get pipefail; it guards against the `curl` command
6362
# failing. otherwise `sh` won't catch that `curl` returned non-0
6463
shell: bash
65-
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
6670
# sure would be cool if github gave us proper conditionals...
6771
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
6872
# functionality based on whether this is a pull_request, and whether it's from a fork.
@@ -111,9 +115,8 @@ jobs:
111115
- uses: actions/checkout@v4
112116
with:
113117
submodules: recursive
114-
- uses: swatinem/rust-cache@v2
115-
with:
116-
key: ${{ join(matrix.targets, '-') }}
118+
- name: "Prepare env vars"
119+
run: "echo \"RUSTFLAGS=--cfg tokio_unstable\" >> $GITHUB_ENV"
117120
- name: Install cargo-dist
118121
run: ${{ matrix.install_dist }}
119122
# Get the dist-manifest
@@ -165,9 +168,12 @@ jobs:
165168
- uses: actions/checkout@v4
166169
with:
167170
submodules: recursive
168-
- name: Install cargo-dist
169-
shell: bash
170-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh"
171+
- name: Install cached cargo-dist
172+
uses: actions/download-artifact@v4
173+
with:
174+
name: cargo-dist-cache
175+
path: ~/.cargo/bin/
176+
- run: chmod +x ~/.cargo/bin/cargo-dist
171177
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
172178
- name: Fetch local artifacts
173179
uses: actions/download-artifact@v4
@@ -211,16 +217,19 @@ jobs:
211217
- uses: actions/checkout@v4
212218
with:
213219
submodules: recursive
214-
- name: Install cargo-dist
215-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh"
220+
- name: Install cached cargo-dist
221+
uses: actions/download-artifact@v4
222+
with:
223+
name: cargo-dist-cache
224+
path: ~/.cargo/bin/
225+
- run: chmod +x ~/.cargo/bin/cargo-dist
216226
# Fetch artifacts from scratch-storage
217227
- name: Fetch artifacts
218228
uses: actions/download-artifact@v4
219229
with:
220230
pattern: artifacts-*
221231
path: target/distrib/
222232
merge-multiple: true
223-
# This is a harmless no-op for GitHub Releases, hosting for that happens in "announce"
224233
- id: host
225234
shell: bash
226235
run: |
@@ -234,6 +243,28 @@ jobs:
234243
# Overwrite the previous copy
235244
name: artifacts-dist-manifest
236245
path: dist-manifest.json
246+
# Create a GitHub Release while uploading all files to it
247+
- name: "Download GitHub Artifacts"
248+
uses: actions/download-artifact@v4
249+
with:
250+
pattern: artifacts-*
251+
path: artifacts
252+
merge-multiple: true
253+
- name: Cleanup
254+
run: |
255+
# Remove the granular manifests
256+
rm -f artifacts/*-dist-manifest.json
257+
- name: Create GitHub Release
258+
env:
259+
PRERELEASE_FLAG: "${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}"
260+
ANNOUNCEMENT_TITLE: "${{ fromJson(steps.host.outputs.manifest).announcement_title }}"
261+
ANNOUNCEMENT_BODY: "${{ fromJson(steps.host.outputs.manifest).announcement_github_body }}"
262+
RELEASE_COMMIT: "${{ github.sha }}"
263+
run: |
264+
# Write and read notes from a file to avoid quoting breaking things
265+
echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt
266+
267+
gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
237268
238269
publish-homebrew-formula:
239270
needs:
@@ -275,7 +306,6 @@ jobs:
275306
done
276307
git push
277308
278-
# Create a GitHub Release while uploading all files to it
279309
announce:
280310
needs:
281311
- plan
@@ -292,21 +322,3 @@ jobs:
292322
- uses: actions/checkout@v4
293323
with:
294324
submodules: recursive
295-
- name: "Download GitHub Artifacts"
296-
uses: actions/download-artifact@v4
297-
with:
298-
pattern: artifacts-*
299-
path: artifacts
300-
merge-multiple: true
301-
- name: Cleanup
302-
run: |
303-
# Remove the granular manifests
304-
rm -f artifacts/*-dist-manifest.json
305-
- name: Create GitHub Release
306-
uses: ncipollo/release-action@v1
307-
with:
308-
tag: ${{ needs.plan.outputs.tag }}
309-
name: ${{ fromJson(needs.host.outputs.val).announcement_title }}
310-
body: ${{ fromJson(needs.host.outputs.val).announcement_github_body }}
311-
prerelease: ${{ fromJson(needs.host.outputs.val).announcement_is_prerelease }}
312-
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 = "../templates/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"

libsql-server/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "libsql-server"
33
version = "0.24.19"
44
edition = "2021"
55
default-run = "sqld"
6+
repository = "https://github.com/tursodatabase/libsql"
67

78
[[bin]]
89
name = "sqld"

0 commit comments

Comments
 (0)