name: Tag a release on: push: branches: - main tags-ignore: - "*" jobs: make-tag: runs-on: ubuntu-latest # because we control the release PR title and only allow squashes, # PRs that are named `release: {crate-name} v{version}` will get tagged! # the commit message will look like: `release: {crate-name} v{version} (#{pr-number})` if: "startsWith(github.event.head_commit.message, 'release: ')" steps: - name: Extract tag from commit message env: COMMIT_MESSAGE: ${{ github.event.head_commit.message }} run: | set -euxo pipefail message="$(head -n1 <<< "$COMMIT_MESSAGE")" crate="$(cut -d ' ' -f 2 <<< "${message}")" version="$(cut -d ' ' -f 3 <<< "${message}")" if [[ "$crate" == "watchexec-cli" ]]; then echo "CUSTOM_TAG=${version}" >> $GITHUB_ENV else echo "CUSTOM_TAG=${crate}-${version}" >> $GITHUB_ENV fi - uses: actions/checkout@v4 - name: Push release tag id: tag_version uses: mathieudutour/github-tag-action@v6.2 with: github_token: ${{ secrets.GITHUB_TOKEN }} custom_tag: ${{ env.CUSTOM_TAG }} tag_prefix: '' release-cli: needs: make-tag if: "startsWith(github.event.head_commit.message, 'release: watchexec-cli v')" uses: ./.github/workflows/release-cli.yml secrets: inherit