lexxor 0.9.2

A fast, extensible, greedy, single-pass text tokenizer for Rust
Documentation
name: Release

on:
  workflow_dispatch:  # Allow manual triggering

env:
  CARGO_TERM_COLOR: always

jobs:
  verify:
    name: Verify Package
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - name: Check package
        run: cargo package --no-verify
      - name: Verify project
        run: cargo verify-project
      - name: Check for missing fields
        run: |
          if ! grep -q "description" Cargo.toml; then
            echo "Missing description in Cargo.toml"
            exit 1
          fi
          if ! grep -q "license" Cargo.toml; then
            echo "Missing license in Cargo.toml"
            exit 1
          fi
          if ! grep -q "repository" Cargo.toml; then
            echo "Missing repository in Cargo.toml"
            exit 1
          fi
          if ! grep -q "documentation" Cargo.toml; then
            echo "Missing documentation in Cargo.toml"
            exit 1
          fi
          if ! grep -q "keywords" Cargo.toml; then
            echo "Missing keywords in Cargo.toml"
            exit 1
          fi
          if ! grep -q "categories" Cargo.toml; then
            echo "Missing categories in Cargo.toml"
            exit 1
          fi

  test:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - name: Run tests
        run: cargo test --all-features
      - name: Run doc tests
        run: cargo test --doc

  publish-dry-run:
    name: Publish Dry Run
    needs: [verify, test]
    if: success()
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@stable
      - name: Publish dry run
        run: cargo publish --dry-run

  manual-approval:
    name: Manual Approval
    runs-on: ubuntu-latest
    needs: publish-dry-run
    if: success()

    permissions:
      issues: write

    steps:
      - name: Await Manual Approval
        uses: trstringer/manual-approval@v1
        with:
          secret: ${{ github.TOKEN }}
          approvers: JeffThomas
          minimum-approvals: 1
          issue-title: "Manual Approval Required for Publish"
          issue-body: "Please approve or deny the deployment."

  publish:
    name: Publish to crates.io
    needs: manual-approval
    if: success()
    runs-on: ubuntu-latest
    permissions:
      id-token: write     # Required for OIDC token exchange
    steps:
      - uses: actions/checkout@v5
      - uses: rust-lang/crates-io-auth-action@v1
        id: auth
      - name: Publish
        run: cargo publish
        env:
          CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}