name: Publish Rust package pyth-lazer-publisher-sdk to crates.io

on:
  workflow_dispatch:
  push:
    tags:
      - rust-pyth-lazer-publisher-sdk-v*
jobs:
  publish-pyth-lazer-publisher-sdk:
    name: Publish Rust package pyth-lazer-publisher-sdk to crates.io
    runs-on: ubuntu-latest
    steps:
      - name: Checkout sources
        uses: actions/checkout@v2
      - name: Install Protoc
        uses: arduino/setup-protoc@v3
        with:
          version: "30.2"

      - run: ./publish.sh
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        working-directory: "lazer/publisher_sdk/rust"
