name: Publish Dry Run

on:
  pull_request:
    branches:
      - main
  workflow_dispatch:

jobs:
  dry-run:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - name: Checkout
        uses: actions/checkout@v4

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

      - name: Cache Cargo
        uses: Swatinem/rust-cache@v2

      - name: Run tests
        run: cargo test --locked

      - name: Run clippy (deny warnings)
        run: cargo clippy --locked --all-targets --all-features -- -D warnings

      - name: Cargo publish dry run
        run: cargo publish --locked --dry-run
