Skip to content

Commit 4bccc38

Browse files
committed
release: v0.0.2
1 parent 4a8a616 commit 4bccc38

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

.github/workflows/ci-cd.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,47 @@ jobs:
2828
- name: Detect release commit message
2929
id: detect
3030
run: |
31+
set -euo pipefail
3132
msg="${{ github.event.head_commit.message }}"
32-
echo "Commit message: $msg"
33-
if [[ "$msg" =~ ^release:\ v([0-9]+\.[0-9]+\.[0-9]+)\b ]]; then
33+
echo "Full commit message:\n$msg"
34+
# Use only first line for pattern match
35+
first_line="${msg%%$'\n'*}"
36+
echo "First line: $first_line"
37+
if [[ "$first_line" =~ ^release:\ v([0-9]+\.[0-9]+\.[0-9]+)([[:space:]]|$) ]]; then
3438
ver="${BASH_REMATCH[1]}"
3539
echo "Matched version: $ver"
3640
echo "version=$ver" >> $GITHUB_OUTPUT
3741
echo "match=true" >> $GITHUB_OUTPUT
42+
{
43+
echo "### Detected release commit"
44+
echo "Version: v$ver"
45+
} >> $GITHUB_STEP_SUMMARY
3846
else
3947
echo "No release pattern match (expected: release: vX.Y.Z)"
4048
echo "match=false" >> $GITHUB_OUTPUT
49+
{
50+
echo "### No release tag created"
51+
echo "First line did not match ^release: vX.Y.Z"
52+
} >> $GITHUB_STEP_SUMMARY
4153
fi
54+
- name: Configure git for tagging
55+
if: steps.detect.outputs.match == 'true'
56+
run: |
57+
git config user.name "github-actions"
58+
git config user.email "github-actions@github.com"
4259
- name: Create and push tag
4360
if: steps.detect.outputs.match == 'true'
4461
run: |
62+
set -euo pipefail
4563
ver="${{ steps.detect.outputs.version }}"
64+
echo "Creating tag v$ver"
4665
if git rev-parse -q --verify "refs/tags/v$ver" >/dev/null; then
4766
echo "Tag v$ver already exists; skipping"
4867
exit 0
4968
fi
5069
git tag -a "v$ver" -m "Release v$ver"
5170
git push origin "v$ver"
71+
echo "Tag v$ver pushed. A new workflow run should start for that tag to build & release."
5272
5373
build-matrix:
5474
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'

0 commit comments

Comments
 (0)