1111jobs :
1212 create-tag-and-release :
1313 runs-on : ubuntu-latest
14+
1415 steps :
1516 - name : Checkout code
1617 uses : actions/checkout@v5
3536
3637 NEW_MAJOR=$(echo $NEW | cut -d. -f1)
3738 NEW_MINOR=$(echo $NEW | cut -d. -f2)
38- NEW_PATCH=$(echo $NEW | cut -d. -f3)
39-
4039 OLD_MAJOR=$(echo $OLD | cut -d. -f1)
4140 OLD_MINOR=$(echo $OLD | cut -d. -f2)
42- OLD_PATCH=$(echo $OLD | cut -d. -f3)
4341
4442 if [ "$NEW_MAJOR" -gt "$OLD_MAJOR" ]; then
4543 echo "release_type=major" >> $GITHUB_ENV
@@ -51,15 +49,19 @@ jobs:
5149
5250 - name : Skip if patch
5351 if : env.release_type == 'patch'
54- run : echo "Patch release detected → no tag or release will be created ."
52+ run : echo "⚠️ Patch release detected → skipping tag & release."
5553
5654 - name : Create and push git tag
5755 if : env.release_type != 'patch'
5856 run : |
5957 git config user.name "github-actions[bot]"
6058 git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
61- git tag v${{ env.version }}
62- git push origin v${{ env.version }}
59+ if git rev-parse "v${{ env.version }}" >/dev/null 2>&1; then
60+ echo "✅ Tag v${{ env.version }} already exists, skipping."
61+ else
62+ git tag v${{ env.version }}
63+ git push origin v${{ env.version }}
64+ fi
6365
6466 - name : Setup pnpm
6567 uses : pnpm/action-setup@v4
@@ -70,32 +72,29 @@ jobs:
7072 run : pnpm install --frozen-lockfile
7173
7274 - name : Build
73- run : pnpm run prepare
75+ run : pnpm run build
7476
7577 - name : Extract release notes from CHANGELOG
7678 if : env.release_type != 'patch'
77- id : changelog
7879 run : |
79- # Match lines starting with "## vX.Y.Z " until the next "## "
8080 awk "/^## v${{ env.version }}[[:space:]]/{flag=1; next} /^## /{flag=0} flag" CHANGELOG.md > RELEASE_NOTES.md
81-
82- echo "notes<<EOF" >> $GITHUB_ENV
81+
8382 if [ "${{ env.release_type }}" = "major" ]; then
84- echo "## 🚀 Major Release" >> $GITHUB_ENV
83+ echo "## 🚀 Major Release" > FINAL_NOTES.md
8584 elif [ "${{ env.release_type }}" = "minor" ]; then
86- echo "## ✨ Minor Release" >> $GITHUB_ENV
85+ echo "## ✨ Minor Release" > FINAL_NOTES.md
8786 fi
88- echo "" >> $GITHUB_ENV
89- cat RELEASE_NOTES.md >> $GITHUB_ENV
90- echo "EOF" >> $GITHUB_ENV
87+ echo "" >> FINAL_NOTES.md
88+ cat RELEASE_NOTES.md >> FINAL_NOTES.md
9189
9290 - name : Create GitHub Release
9391 if : env.release_type != 'patch'
9492 uses : softprops/action-gh-release@v2
9593 with :
9694 tag_name : v${{ env.version }}
97- name : ' Release v${{ env.version }}'
98- body : ${{ env.notes }}
95+ name : Release v${{ env.version }}
96+ body_path : FINAL_NOTES.md
9997 make_latest : true
98+ files : dist/**/*
10099 env :
101100 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments