watchexec/.github/workflows/release-tag.yml

46 lines
1.4 KiB
YAML
Raw Normal View History

2022-06-15 05:25:05 +02:00
name: Tag a release
on:
push:
branches:
- main
tags-ignore:
- "*"
2022-06-15 05:25:05 +02:00
jobs:
make-tag:
runs-on: ubuntu-latest
2022-09-07 01:24:53 +02:00
# because we control the release PR title and only allow squashes,
# PRs that are named `release: {crate-name} v{version}` will get tagged!
2022-06-15 05:25:05 +02:00
# 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 }}
2022-06-15 05:25:05 +02:00
run: |
set -euxo pipefail
message="$(head -n1 <<< "$COMMIT_MESSAGE")"
2022-06-15 05:25:05 +02:00
crate="$(cut -d ' ' -f 2 <<< "${message}")"
version="$(cut -d ' ' -f 3 <<< "${message}")"
2022-09-07 01:24:53 +02:00
if [[ "$crate" == "watchexec-cli" ]]; then
echo "CUSTOM_TAG=${version}" >> $GITHUB_ENV
else
echo "CUSTOM_TAG=${crate}-${version}" >> $GITHUB_ENV
fi
2022-06-15 05:25:05 +02:00
- uses: actions/checkout@v4
- name: Push release tag
2022-06-15 05:25:05 +02:00
id: tag_version
uses: mathieudutour/github-tag-action@v6.2
2022-06-15 05:25:05 +02:00
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ env.CUSTOM_TAG }}
2022-06-17 02:47:06 +02:00
tag_prefix: ''
release-cli:
needs: make-tag
2022-09-07 01:24:53 +02:00
if: "startsWith(github.event.head_commit.message, 'release: watchexec-cli v')"
uses: ./.github/workflows/release-cli.yml
secrets: inherit