nsip 0.4.0

NSIP Search API client for nsipsearch.nsip.org/api
Documentation
---
name: Publish to crates.io

"on":
  push:
    tags:
      - "v*.*.*"
  workflow_dispatch:

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always

jobs:
  publish:
    name: Publish to crates.io
    runs-on: ubuntu-latest
    timeout-minutes: 30
    environment: copilot
    steps:
      - name: Checkout repository
        # yamllint disable-line rule:line-length
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd  # v6.0.2

      - name: Setup Rust with caching
        uses: ./.github/actions/setup-rust-cached
        with:
          toolchain: stable
          components: rustfmt, clippy
          cache-key: publish

      - name: Install cargo-deny
        # yamllint disable-line rule:line-length
        uses: ./.github/actions/install-cargo-tool
        with:
          tool: cargo-deny

      - name: Verify package
        run: |
          cargo package --list
          cargo package --allow-dirty

      - name: Run pre-publish checks
        run: |
          cargo fmt -- --check
          cargo clippy --all-targets --all-features -- -D warnings
          cargo test --all-features
          cargo doc --no-deps --all-features
          cargo deny check

      - name: Dry run publish
        run: cargo publish --dry-run --allow-dirty

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