on:
  # workflow_run:
  #   workflows: ["Check SemVer compliance"]
  #   types:
  #     - completed
  release:
    types: [published]

name: Publish to crates.io on release

jobs:
  prepare:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true

  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: katyo/publish-crates@v1
        with:
          dry-run: true
          check-repo: ${{ github.event_name == 'push' }}
          registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
          ignore-unpublished-changes: true
