-
-
Notifications
You must be signed in to change notification settings - Fork 1
37 lines (30 loc) · 965 Bytes
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Publish
on:
push:
branches:
- main
jobs:
check-release:
runs-on: ubuntu-latest
outputs:
should_publish: ${{ steps.check_release.outputs.should_publish }}
steps:
- name: 📚 Git Checkout
uses: actions/checkout@v4
- name: 🔍 Check if There is a Release Commit
id: check_release
run: |
# Get the latest commit message
latest_commit_msg=$(git log -1 --pretty=%B)
# Check if the commit message matches the release pattern
if [[ "$latest_commit_msg" =~ ^chore\(release\):\ v.* ]]; then
echo "should_publish=true" >> $GITHUB_OUTPUT
else
echo "should_publish=false" >> $GITHUB_OUTPUT
fi
publish:
needs: check-release
if: needs.check-release.outputs.should_publish == 'true'
uses: halildurmus/workflows/.github/workflows/dart_pub_publish.yml@main
secrets:
token: ${{ secrets.PAT }}