bento-kit 0.1.1

A bento box of common Rust utilities: id generation, timing, masking
Documentation
name: Release

on:
  push:
    tags:
      - "v*"

jobs:
  publish:
    name: cargo publish
    runs-on: ubuntu-latest
    environment: crates-io
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2

      - name: Derive version from tag
        id: ver
        run: |
          TAG="${GITHUB_REF#refs/tags/v}"
          if ! echo "$TAG" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$'; then
            echo "tag '$TAG' is not a valid semver string" >&2
            exit 1
          fi
          echo "version=$TAG" >> "$GITHUB_OUTPUT"
          echo "Releasing version: $TAG"

      - name: Stamp version into Cargo.toml
        run: |
          cargo install cargo-edit --locked --quiet
          cargo set-version "${{ steps.ver.outputs.version }}"
          # Show the resulting version line for the run log.
          grep -E '^version =' Cargo.toml

      - name: cargo test (sanity)
        run: cargo test --locked --all-features

      - name: cargo publish
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: cargo publish --locked --all-features --allow-dirty