v0.1.0 #1
Workflow file for this run
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
| name: Release | |
| on: | |
| release: | |
| types: [published] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Verify version matches tag | |
| run: | | |
| CARGO_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') | |
| TAG_VERSION=${GITHUB_REF#refs/tags/v} | |
| if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then | |
| echo "Version mismatch: Cargo.toml=$CARGO_VERSION, tag=$TAG_VERSION" | |
| exit 1 | |
| fi | |
| echo "Version verified: $CARGO_VERSION" | |
| - name: Build | |
| run: cargo build --release | |
| - name: Run tests | |
| run: cargo test --release | |
| - name: Publish to crates.io | |
| run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} |