-
Notifications
You must be signed in to change notification settings - Fork 6
ci: add tag-driven release workflow #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| # Copyright 2026 The Zilkworm Authors | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: ['v*'] | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: Existing tag to build a release for, e.g. v0.1.0-alpha.2 | ||
| required: true | ||
|
|
||
| concurrency: | ||
| group: release-${{ github.event.inputs.tag || github.ref_name }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Build artifacts and publish release | ||
| runs-on: ubuntu-latest | ||
| environment: ci | ||
| permissions: | ||
| contents: write | ||
| packages: read | ||
| container: | ||
| image: ghcr.io/erigontech/zilkworm-ci:latest | ||
| credentials: | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
| env: | ||
| TAG: ${{ github.event.inputs.tag || github.ref_name }} | ||
| steps: | ||
| - name: Resolve version | ||
| id: ver | ||
| shell: bash | ||
| run: | | ||
| version="${TAG#v}" | ||
| echo "version=$version" >> "$GITHUB_OUTPUT" | ||
| # alpha/beta/rc tags carry a '-' suffix -> mark as pre-release. | ||
| if [[ "$TAG" == *-* ]]; then | ||
| echo "prerelease=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "prerelease=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ env.TAG }} | ||
| submodules: false | ||
|
|
||
| - name: Init submodules | ||
| uses: ./.github/actions/init-submodules | ||
| with: | ||
| token: ${{ secrets.PAT_TOKEN || github.token }} | ||
| sparse-eest-fixtures: "skip" | ||
|
|
||
| - name: Verify tag matches PROJECT_VERSION | ||
| shell: bash | ||
| run: | | ||
| cmake_ver=$(grep -oP 'set\(PROJECT_VERSION \K[^)]+' CMakeLists.txt) | ||
| if [[ "$cmake_ver" != "${{ steps.ver.outputs.version }}" ]]; then | ||
| echo "Tag $TAG implies version ${{ steps.ver.outputs.version }}, but CMakeLists.txt PROJECT_VERSION is $cmake_ver" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Build guest ELF and prover | ||
| run: make z6m_prover | ||
|
|
||
| - name: Build state_transition CLI | ||
| run: | | ||
| cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release | ||
| cmake --build build --target state_transition -j"$(nproc)" | ||
|
|
||
| - name: Stage release artifacts | ||
| run: make release-artifacts | ||
|
|
||
| - name: Extract changelog section | ||
| shell: bash | ||
| run: | | ||
| awk -v tag="$TAG" ' | ||
| $0 ~ "^## " tag "([ ]|$)" { f=1; print; next } | ||
| f && /^## / { f=0 } | ||
| f { print } | ||
| ' CHANGELOG.md > RELEASE_NOTES.md | ||
| if [[ ! -s RELEASE_NOTES.md ]]; then | ||
| echo "No CHANGELOG.md section found for $TAG." > RELEASE_NOTES.md | ||
| fi | ||
|
|
||
| - name: Publish GitHub release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: ${{ env.TAG }} | ||
| name: ${{ env.TAG }} | ||
| body_path: RELEASE_NOTES.md | ||
| prerelease: ${{ steps.ver.outputs.prerelease }} | ||
| fail_on_unmatched_files: true | ||
| files: | | ||
| temp/z6m_guest_hypercube.elf | ||
| temp/z6m_prover_hypercube | ||
| temp/state_transition_linux_x86_64 | ||
| temp/SHA256SUMS.txt | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <!-- | ||
| Copyright 2026 The Zilkworm Authors | ||
| SPDX-License-Identifier: Apache-2.0 | ||
| --> | ||
|
|
||
| # Release process | ||
|
|
||
| Version is single-sourced from `PROJECT_VERSION` in [`CMakeLists.txt`](../CMakeLists.txt). | ||
| Tagging `vX.Y.Z` triggers [`.github/workflows/release.yml`](../.github/workflows/release.yml), | ||
| which builds the artifacts and publishes the GitHub release. | ||
| An optional suffix after `vX.Y.Z` is free-form (e.g. `-alpha.2`, `-rc.1`) but the whole tag must | ||
| equal `PROJECT_VERSION`; any `-` suffix marks the release as a pre-release. | ||
|
|
||
| ## Steps | ||
|
|
||
| 1. Branch: typically `release/X.Y.Z` but any other branch works. | ||
| 2. Bump `PROJECT_VERSION` in `CMakeLists.txt` to `X.Y.Z` on such branch. | ||
| 3. Add the `## vX.Y.Z - <title>` section to [`CHANGELOG.md`](../CHANGELOG.md) (release notes | ||
| are extracted from it). | ||
| 4. Commit and push the branch. | ||
| 5. Tag the release commit and push the tag: | ||
| ```sh | ||
| git tag vX.Y.Z && git push origin vX.Y.Z | ||
| ``` | ||
| The tag must match `PROJECT_VERSION` or the release workflow fails. | ||
|
|
||
| The workflow then builds the release binaries, generates `SHA256SUMS.txt`, and publishes them | ||
| to the `vX.Y.Z` GitHub release with the CHANGELOG section as the body. | ||
|
|
||
| ## Releasing from any branch | ||
|
|
||
| The workflow is tag-driven, not branch-driven: the tag is checked out by commit, | ||
| so a `vX.Y.Z` tag can sit on any branch, not just `release/*`. | ||
| The branch name is irrelevant; the conditions in step 5 still apply. | ||
|
|
||
| ## Release an existing tag | ||
|
|
||
| If a `vX.Y.Z` tag was pushed before this workflow existed (or a run needs to be | ||
| redone), trigger it manually via **Actions → Release → Run workflow**, passing | ||
| the tag. Re-publishing the same tag updates the release and overwrites its assets. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this file generated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is generated by
make release-artifactshere