# Name of the workflow: you can change it.
name: csh_release-plz

# The action runs on every push to the main branch.
on:
  push:
    branches:
      - main

jobs:
  # Create a PR with the new versions and changelog, preparing the next release.
  # If you want release-plz to only release your packages
  # and you want to update `Cargo.toml` versions and changelogs by yourself,
  # remove this job.
  release-plz-pr:
    name: Release-plz PR
    runs-on: ubuntu-latest

    # The concurrency block is explained below (after the code block).
    concurrency:
      group: release-plz-${{ github.ref }}
      cancel-in-progress: false
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          # `fetch-depth: 0` is needed to clone all the git history, which is necessary to
          # determine the next version and build the changelog.
          fetch-depth: 0
          token: ${{ secrets.RELEASE_PLZ_TOKEN }}
      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
      - name: Run release-plz
        uses: release-plz/action@v0.5
        env:
          GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
          # In `release-plz-pr` this is only required if you are using a private registry.
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}