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

42 lines
1.3 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
# because only bors can push to main, and it squashes, only 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 }}
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-06-15 05:25:05 +02:00
echo "CUSTOM_TAG=${crate}-${version}" >> $GITHUB_ENV
- uses: actions/checkout@v2
- name: Push release tag
2022-06-15 05:25:05 +02:00
id: tag_version
uses: mathieudutour/github-tag-action@v6.0
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
if: "startsWith(github.event.head_commit.message, 'release: cli v')"
uses: ./.github/workflows/release-cli.yml
secrets: inherit