Skip to content

Commit 8526654

Browse files
committed
ci: simplify auto release workflow guard
1 parent 126233a commit 8526654

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

.github/workflows/auto-release.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Auto Release
22

3-
on:
3+
"on":
44
push:
55
branches: [main]
66
workflow_dispatch:
@@ -16,7 +16,6 @@ jobs:
1616
decide:
1717
name: Decide release
1818
runs-on: ubuntu-latest
19-
if: ${{ github.event_name != 'push' || !startsWith(github.event.head_commit.message, 'chore(release): prepare ') }}
2019
steps:
2120
- name: Checkout
2221
uses: actions/checkout@v6
@@ -26,9 +25,22 @@ jobs:
2625
- name: Decide next beta version
2726
id: version
2827
shell: bash
28+
env:
29+
EVENT_NAME: ${{ github.event_name }}
30+
HEAD_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
2931
run: |
3032
set -euo pipefail
3133
34+
if [[ "$EVENT_NAME" == "push" ]]; then
35+
case "$HEAD_COMMIT_MESSAGE" in
36+
"chore(release): prepare "*)
37+
echo "Release preparation commit detected; auto release skipped."
38+
echo "publish=false" >> "$GITHUB_OUTPUT"
39+
exit 0
40+
;;
41+
esac
42+
fi
43+
3244
latest_tag=$(git tag --list 'v*-beta.*' --sort=-version:refname | head -n 1)
3345
if [[ -z "$latest_tag" ]]; then
3446
echo "No beta tag found; starting from v0.1-beta.1."

0 commit comments

Comments
 (0)