33 pull_request :
44 types : [closed]
55 branches :
6- - main
7- - next
8- push :
9- branches :
10- - main
11- - next
12-
6+ - main
137permissions :
148 contents : write
159 issues : write
1610 pull-requests : write
17- packages : write
1811
1912jobs :
2013 release :
2114 runs-on : ubuntu-latest
2215 if : |
23- ( github.event_name == 'pull_request' && github. event.pull_request.merged == true) ||
24- ( github.event_name == 'push')
16+ github.event.pull_request.merged == true &&
17+ github.event.pull_request.base.ref == 'main'
2518
2619 steps :
2720 - name : 🔍 Debug Info
2821 run : |
2922 echo "Event: ${{ github.event_name }}"
30- echo "Ref : ${{ github.ref }}"
31- echo "Branch: ${{ github.ref_name }}"
23+ echo "PR Base Branch : ${{ github.event.pull_request.base .ref }}"
24+ echo "PR Head Branch: ${{ github.event.pull_request.head.ref }}"
3225 echo "Merged: ${{ github.event.pull_request.merged }}"
3326
3427 - name : 📥 Checkout
3528 uses : actions/checkout@v4
3629 with :
37- fetch-depth : 0 # Required for semantic-release
30+ fetch-depth : 0
31+ # Checkout main branch (target branch)
32+ ref : main
3833 token : ${{ secrets.GITHUB_TOKEN }}
3934
4035 - name : 📦 Setup Node.js
4136 uses : actions/setup-node@v4
4237 with :
4338 node-version : " 22.x"
4439 cache : ' npm'
45- registry-url : ' https://registry.npmjs.org'
4640
4741 - name : 📋 Install dependencies
4842 run : npm ci
4943
5044 - name : 🏗️ Build
5145 run : npm run build
5246
53- - name : 🔐 Audit
54- run : npm audit signatures
55-
5647 - name : 🧪 Run tests
5748 run : npm run test:ci
5849
59- - name : 🔍 Debug semantic-release (dry-run)
60- run : npx semantic-release --dry-run
61- env :
62- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
63- NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
64- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
65-
6650 - name : 🚀 Release
6751 run : npx semantic-release
6852 env :
6953 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
70- NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
71- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
72-
73- - name : 📊 Release Status
74- if : always()
75- run : |
76- echo "✅ Release workflow completed"
77- echo "Check the logs above for any issues"
54+ NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments