tse-client 0.3.0

A client for fetching stock data from the Tehran Stock Exchange (TSETMC). Rust port of the tse-client npm package.
Documentation
name: Publish

# Publishes the crate to crates.io when a version tag is pushed.
#
# Setup (one-time):
#   1. Create a crates.io API token: https://crates.io/settings/tokens
#   2. Add it to the repo as a secret named `CARGO_REGISTRY_TOKEN`
#      (Settings -> Secrets and variables -> Actions -> New repository secret).
#
# Release flow:
#   1. Bump `version` in Cargo.toml and commit.
#   2. Tag the commit, e.g.  git tag v0.1.0  &&  git push origin v0.1.0
#   3. This workflow verifies, then publishes the crate.

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

env:
  CARGO_TERM_COLOR: always

jobs:
  publish:
    name: Publish to crates.io
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

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

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

      - name: Verify tag matches Cargo.toml version
        run: |
          TAG="${GITHUB_REF_NAME#v}"
          CRATE_VERSION="$(cargo metadata --no-deps --format-version 1 \
            | python3 -c 'import sys, json; print(json.load(sys.stdin)["packages"][0]["version"])')"
          echo "tag=$TAG crate=$CRATE_VERSION"
          if [ "$TAG" != "$CRATE_VERSION" ]; then
            echo "::error::Tag v$TAG does not match Cargo.toml version $CRATE_VERSION"
            exit 1
          fi

      - name: Test
        run: cargo test --verbose

      - name: Package (dry run)
        run: cargo publish --dry-run

      - name: Publish
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: cargo publish