2022-06-15 05:25:05 +02:00
|
|
|
name: Tag a release
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2022-06-16 12:48:28 +02:00
|
|
|
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
|
2022-06-16 13:34:58 +02:00
|
|
|
env:
|
|
|
|
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
2022-06-15 05:25:05 +02:00
|
|
|
run: |
|
|
|
|
set -euxo pipefail
|
2022-06-16 12:48:28 +02:00
|
|
|
|
2022-06-16 13:34:58 +02:00
|
|
|
message="$(head -n1 <<< "$COMMIT_MESSAGE")"
|
2022-06-15 05:25:05 +02:00
|
|
|
crate="$(cut -d ' ' -f 2 <<< "${message}")"
|
2022-06-16 12:48:28 +02:00
|
|
|
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
|
2022-06-16 12:48:28 +02:00
|
|
|
- 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: ''
|
2022-06-23 12:29:04 +02:00
|
|
|
|
|
|
|
release-cli:
|
|
|
|
needs: make-tag
|
2022-06-28 15:25:10 +02:00
|
|
|
if: "startsWith(github.event.head_commit.message, 'release: cli v')"
|
2022-06-23 12:29:04 +02:00
|
|
|
uses: ./.github/workflows/release-cli.yml
|
|
|
|
secrets: inherit
|