tradestation-api 0.1.0

Complete TradeStation REST API v3 wrapper for Rust
Documentation
name: Publish to crates.io

on:
  release:
    types: [published]

env:
  CARGO_TERM_COLOR: always

jobs:
  # Run full test suite before publishing
  test:
    name: Pre-publish Tests
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - run: cargo test --all-targets
      - run: cargo clippy --all-targets -- -D warnings
      - run: cargo fmt --check
      - run: cargo doc --no-deps
        env:
          RUSTDOCFLAGS: -D warnings

  publish:
    name: Publish
    needs: test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2

      # Verify the version in Cargo.toml matches the release tag
      - name: Verify version
        run: |
          CARGO_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
          TAG_VERSION="${GITHUB_REF_NAME#v}"
          if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then
            echo "ERROR: Cargo.toml version ($CARGO_VERSION) != tag version ($TAG_VERSION)"
            exit 1
          fi
          echo "Version match: $CARGO_VERSION"

      # Dry run first
      - name: Publish dry run
        run: cargo publish --dry-run

      # Publish to crates.io
      - name: Publish to crates.io
        run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}