File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,22 +2,32 @@ name: Publish to npm
22
33on :
44 workflow_dispatch :
5- pull_request :
6- types : [closed]
5+ push :
76 branches : [main]
7+ paths :
8+ - " package.json"
89
910jobs :
1011 publish-dry-run :
11- if : >
12- github.event_name == 'workflow_dispatch' ||
13- (github.event.pull_request.merged == true &&
14- contains(github.event.pull_request.labels.*.name, 'ci-release'))
12+ if : " ${{ github.event_name == 'workflow_dispatch' || startsWith(github.event.head_commit.message, 'chore: release v') }}"
1513 runs-on : ubuntu-latest
1614 environment : general
1715
1816 steps :
1917 - uses : actions/checkout@v4
2018
19+ - name : Validate release commit
20+ if : github.event_name == 'push'
21+ run : |
22+ COMMIT_MSG="${{ github.event.head_commit.message }}"
23+ # Extract version from commit message and validate semver format
24+ if [[ "$COMMIT_MSG" =~ ^chore:\ release\ v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
25+ echo "Valid release commit: ${BASH_REMATCH[1]}"
26+ else
27+ echo "Commit message does not match expected pattern: chore: release vX.Y.Z"
28+ exit 1
29+ fi
30+
2131 - name : Use Node.js 22
2232 uses : actions/setup-node@v4
2333 with :
You can’t perform that action at this time.
0 commit comments