name: Release
on:
workflow_dispatch:
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
PROTOC_VERSION: '3.25.3'
concurrency:
group: release
cancel-in-progress: false
jobs:
validate:
name: Validate
uses: ./.github/workflows/main.yml
validate-e2e:
name: Validate E2E
uses: ./.github/workflows/e2e.yml
secrets: inherit
publish:
name: Publish to crates.io
needs: [validate, validate-e2e]
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2026-01-30
- name: Install protoc
uses: taiki-e/install-action@v2
with:
tool: protoc@${{ env.PROTOC_VERSION }}
- name: Install cargo-release
run: cargo install cargo-release --locked --version 0.25.20
- uses: Swatinem/rust-cache@v2
- name: Publish workspace crates
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo release publish --workspace --execute --no-confirm
github-release:
name: Create GitHub Release
needs: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract version
id: version
run: |
VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
- name: Create tag
run: |
TAG="${{ steps.version.outputs.tag }}"
if git ls-remote --exit-code --tags origin "refs/tags/$TAG" > /dev/null 2>&1; then
echo "Tag $TAG already exists on origin, skipping."
else
git tag "$TAG"
git push origin "$TAG"
fi
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view "${{ steps.version.outputs.tag }}" > /dev/null 2>&1; then
echo "Release ${{ steps.version.outputs.tag }} already exists, skipping."
else
gh release create "${{ steps.version.outputs.tag }}" \
--title "${{ steps.version.outputs.tag }}" \
--generate-notes \
--latest
fi