steam-client-rs 0.2.0

Steam client for Rust - Individual and Anonymous user account types
Documentation
name: Release

on:
  push:
    tags:
      - 'v*'

permissions:
  contents: write

jobs:
  release:
    name: Publish & Release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2

      - name: Verify tag matches Cargo.toml version
        run: |
          TAG=${GITHUB_REF#refs/tags/v}
          CARGO_VER=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].version')
          if [ "$TAG" != "$CARGO_VER" ]; then
            echo "::error::Tag v$TAG does not match Cargo.toml version $CARGO_VER"
            exit 1
          fi

      # Tests, lints, and a dry-run publish must all pass before we touch
      # crates.io. `cargo publish` is irreversible (modulo yank), so we gate it
      # behind every other check.
      - name: Run tests
        run: cargo test --all-features

      - name: cargo fmt
        run: cargo fmt --all -- --check

      - name: cargo clippy
        run: cargo clippy --all-targets --all-features -- -D warnings

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

      - name: Publish to crates.io
        run: cargo publish --locked
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

      - name: Create GitHub Release
        uses: softprops/action-gh-release@v2
        with:
          generate_release_notes: true