Skip to content

Commit f117a1a

Browse files
committed
ci: build and publish nightly binaries on main pushes
Run the release build on pushes to main in addition to v* tags. On main, move the `nightly` tag to the pushed commit, publish a `nightly` prerelease with the per-target binaries, and include a `commit` file recording the exact sha so the download step can verify a prebuilt matches the user's checked-out source.
1 parent 9c537ae commit f117a1a

1 file changed

Lines changed: 30 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Release
22

33
on:
44
push:
5+
branches: [main]
56
tags: ["v*"]
67
workflow_dispatch:
78

@@ -94,17 +95,44 @@ jobs:
9495
needs: build
9596
runs-on: ubuntu-latest
9697
steps:
98+
- uses: actions/checkout@v4
9799
- uses: actions/download-artifact@v4
98100
with:
99101
path: artifacts
100-
- name: Collect binaries and checksums
102+
- name: Assemble dist
103+
shell: bash
101104
run: |
102105
mkdir -p dist
103106
find artifacts -type f -name 'lockfile_native-*' -exec cp {} dist/ \;
107+
# For nightly builds, record the exact commit so the download step can
108+
# verify a prebuilt matches the user's checked-out source before using it.
109+
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
110+
echo "${{ github.sha }}" > dist/commit
111+
fi
104112
(cd dist && sha256sum * > SHA256SUMS)
105113
ls -la dist
106-
- uses: softprops/action-gh-release@v2
114+
115+
# Tagged release (v*): publish a normal release for that tag.
116+
- name: Publish release
117+
if: startsWith(github.ref, 'refs/tags/v')
118+
uses: softprops/action-gh-release@v2
107119
with:
108120
files: dist/*
109121
fail_on_unmatched_files: false
110122
generate_release_notes: true
123+
124+
# main: move the `nightly` tag to this commit and refresh its prerelease.
125+
- name: Move nightly tag
126+
if: github.ref == 'refs/heads/main'
127+
run: |
128+
git tag -f nightly "${{ github.sha }}"
129+
git push -f origin "refs/tags/nightly"
130+
- name: Publish nightly
131+
if: github.ref == 'refs/heads/main'
132+
uses: softprops/action-gh-release@v2
133+
with:
134+
tag_name: nightly
135+
name: nightly
136+
prerelease: true
137+
files: dist/*
138+
fail_on_unmatched_files: false

0 commit comments

Comments
 (0)