@@ -2,13 +2,12 @@ name: Release
22
33on :
44 push :
5- branches : [main]
5+ tags :
6+ - ' v*'
67 workflow_dispatch :
78
89permissions :
910 contents : write
10- issues : write
11- pull-requests : write
1211 id-token : write
1312
1413concurrency :
@@ -24,18 +23,12 @@ jobs:
2423 name : Release
2524 runs-on : ubuntu-latest
2625 timeout-minutes : 15
27- outputs :
28- released : ${{ steps.semantic.outputs.new_release_published }}
29- version : ${{ steps.semantic.outputs.new_release_version }}
30- channel : ${{ steps.semantic.outputs.new_release_channel }}
31- tag : ${{ steps.semantic.outputs.new_release_git_tag }}
3226
3327 steps :
3428 - name : Checkout
3529 uses : actions/checkout@v4
3630 with :
3731 fetch-depth : 0
38- persist-credentials : false
3932
4033 - name : Setup pnpm
4134 uses : pnpm/action-setup@v4
@@ -55,65 +48,23 @@ jobs:
5548 - name : Build
5649 run : pnpm build
5750
58- - name : Semantic Release
59- id : semantic
60- env :
61- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
62- NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
63- GIT_AUTHOR_NAME : ' github-actions[bot]'
64- GIT_AUTHOR_EMAIL : ' github-actions[bot]@users.noreply.github.com'
65- GIT_COMMITTER_NAME : ' github-actions[bot]'
66- GIT_COMMITTER_EMAIL : ' github-actions[bot]@users.noreply.github.com'
67- run : pnpm semantic-release
68-
69- - name : Summary
70- if : always()
71- run : |
72- if [ "${{ steps.semantic.outputs.new_release_published }}" == "true" ]; then
73- echo "## Release Published" >> $GITHUB_STEP_SUMMARY
74- echo "" >> $GITHUB_STEP_SUMMARY
75- echo "**Version:** \`${{ steps.semantic.outputs.new_release_version }}\`" >> $GITHUB_STEP_SUMMARY
76- echo "**Tag:** \`${{ steps.semantic.outputs.new_release_git_tag }}\`" >> $GITHUB_STEP_SUMMARY
77- echo "" >> $GITHUB_STEP_SUMMARY
78- echo "[npm](https://www.npmjs.com/package/next-dynenv/v/${{ steps.semantic.outputs.new_release_version }}) · [Release Notes](https://github.com/${{ github.repository }}/releases/tag/${{ steps.semantic.outputs.new_release_git_tag }})" >> $GITHUB_STEP_SUMMARY
79- else
80- echo "## No Release" >> $GITHUB_STEP_SUMMARY
81- echo "" >> $GITHUB_STEP_SUMMARY
82- echo "No releasable changes detected." >> $GITHUB_STEP_SUMMARY
83- fi
51+ - name : Run tests
52+ run : pnpm test
8453
85- back-merge :
86- name : Back-merge
87- runs-on : ubuntu-latest
88- needs : release
89- if : needs.release.outputs.released == 'true'
90- timeout-minutes : 5
54+ - name : Publish to npm
55+ run : pnpm publish --access public --no-git-checks
56+ env :
57+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
9158
92- steps :
93- - name : Checkout
94- uses : actions/checkout@v4
59+ - name : Create GitHub Release
60+ uses : softprops/action-gh-release@v2
9561 with :
96- fetch-depth : 0
97- token : ${{ secrets.GITHUB_TOKEN }}
62+ generate_release_notes : true
9863
99- - name : Configure Git
100- run : |
101- git config user.name "github-actions[bot]"
102- git config user.email "github-actions[bot]@users.noreply.github.com"
103-
104- - name : Merge to development
64+ - name : Summary
10565 run : |
106- git fetch origin main development
107- git checkout development
108- git pull origin development
109-
110- if git merge origin/main --no-ff -m "chore: back-merge main into development [skip ci]"; then
111- git push origin development
112- echo "## Back-merge Complete" >> $GITHUB_STEP_SUMMARY
113- echo "Successfully merged main → development" >> $GITHUB_STEP_SUMMARY
114- else
115- echo "## Back-merge Failed" >> $GITHUB_STEP_SUMMARY
116- echo "Merge conflict detected. Manual merge required." >> $GITHUB_STEP_SUMMARY
117- git merge --abort
118- exit 1
119- fi
66+ echo "## Release Published" >> $GITHUB_STEP_SUMMARY
67+ echo "" >> $GITHUB_STEP_SUMMARY
68+ echo "**Tag:** \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY
69+ echo "" >> $GITHUB_STEP_SUMMARY
70+ echo "[npm](https://www.npmjs.com/package/next-dynenv) · [Release](https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }})" >> $GITHUB_STEP_SUMMARY
0 commit comments