longline 0.12.1

System-installed safety hook for Claude Code
Documentation
name: Release

on:
  push:
    tags:
      - 'v*'
  workflow_dispatch:

env:
  CARGO_TERM_COLOR: always

jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Verify version matches tag
        if: startsWith(github.ref, 'refs/tags/')
        run: |
          CARGO_VERSION="v$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')"
          if [ "$CARGO_VERSION" != "${{ github.ref_name }}" ]; then
            echo "Tag ${{ github.ref_name }} doesn't match Cargo.toml version $CARGO_VERSION"
            exit 1
          fi

      - name: Run tests
        run: cargo test

      - name: Enable publishing
        if: startsWith(github.ref, 'refs/tags/')
        run: sed -i 's/publish = false/publish = true/' Cargo.toml

      - name: Publish to crates.io
        if: startsWith(github.ref, 'refs/tags/')
        run: cargo publish --allow-dirty
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

      - name: Create GitHub Release
        if: startsWith(github.ref, 'refs/tags/')
        uses: softprops/action-gh-release@v2
        with:
          generate_release_notes: true