Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 0.9.2)'
required: true
type: string

permissions:
contents: write
pull-requests: read

jobs:
verify-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Check version matches input
run: |
CURRENT_VERSION=$(grep -A1 "^\[workspace\.package\]" Cargo.toml | grep "version" | sed 's/.*= "\(.*\)"/\1/')
if [ "$CURRENT_VERSION" != "${{ github.event.inputs.version }}" ]; then
echo "Version mismatch: Cargo.toml has $CURRENT_VERSION but input is ${{ github.event.inputs.version }}"
exit 1
fi
echo "Version $CURRENT_VERSION matches input"

run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

- name: Run tests
run: cargo test --workspace

- name: Check examples compile
run: cargo check --examples

create-release:
needs: [verify-version, run-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ github.event.inputs.version }}
name: Release v${{ github.event.inputs.version }}
body: Release v${{ github.event.inputs.version }}
draft: false
prerelease: false

publish-crates:
needs: [create-release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

# helper tool to publish all workspace crates in correct order
- name: Install cargo-workspaces
run: cargo install cargo-workspaces

- name: Publish all crates
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
# flags:
# --from-git: uses git source to determine versions
# --no-verify: because `bert-single-file-binary-builder` modifies files during build.rs
# --yes: skip confirmation prompt
# --token: use the provided token for authentication
run: |
cargo workspaces publish --from-git --no-verify --yes --token $CARGO_REGISTRY_TOKEN
Loading