name: publish

on:
  push:
    tags:
      - erratic-[0-9]+.*

jobs:
  publish:
    name: cargo publish
    environment: publish
    env:
      CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO }}
    # only publish from the origin repository
    if: github.repository_owner == 'lansyin'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - name: "Publish to crates.io"
        run: cargo publish
