Handle multi-line commit messages in release-tag workflow (#315)

This commit is contained in:
Félix Saparelli 2022-06-16 10:48:28 +00:00
parent 5ee0356e34
commit e1d1940261
3 changed files with 22 additions and 8 deletions

View File

@ -5,8 +5,7 @@ on:
branches:
- main
tags-ignore:
- "cli-v*.*.*"
- "lib-v*.*.*"
- "*"
jobs:
check:

View File

@ -6,8 +6,7 @@ on:
- staging
- trying
tags-ignore:
- "cli-v*.*.*"
- "lib-v*.*.*"
- "*"
jobs:
test:
@ -43,6 +42,9 @@ jobs:
profile: minimal
toolchain: "${{ matrix.toolchain }}"
override: true
- uses: actions-rs/cargo@v1
- name: Run test suite
uses: actions-rs/cargo@v1
with:
command: test
- name: Check that CLI runs
run: cargo run -p watchexec-cli -- -1 echo

View File

@ -3,6 +3,8 @@ on:
push:
branches:
- main
tags-ignore:
- "*"
jobs:
make-tag:
@ -15,13 +17,24 @@ jobs:
- name: Extract tag from commit message
run: |
set -euxo pipefail
message="${{ github.event.head_commit.message }}"
read -r -d '' message <<'COMMITMESSAGESEPARATOR'
${{ github.event.head_commit.message }}
COMMITMESSAGESEPARATOR
# trim both ends
message="${message#"${message%%[![:space:]]*}"}"
message="${message%"${message##*[![:space:]]}"}"
# get first line
message="$(head -n1 <<< "$message")"
crate="$(cut -d ' ' -f 2 <<< "${message}")"
version="$(cut -d ' ' -f 3 <<< "${message}" | tr -d 'v')"
version="$(cut -d ' ' -f 3 <<< "${message}")"
echo "CUSTOM_TAG=${crate}-${version}" >> $GITHUB_ENV
- uses: actions/checkout@v2
- name: Bump version and push tag
- name: Push release tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.0
with: