Skip to content

Commit 0b16ac9

Browse files
committed
refactor(workflows): Move release creation to tag-after-merge
Moves the steps for extracting release notes and creating the GitHub Release from the `release.yml` workflow to the `tag-after-merge.yml` workflow. This ensures that the release is only created after the new version tag has been successfully pushed, which is a more robust release process.
1 parent 5451134 commit 0b16ac9

2 files changed

Lines changed: 27 additions & 27 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,4 @@ jobs:
3838
- name: Add build artifacts
3939
run: git add dist -f
4040

41-
- name: Extract release notes from CHANGELOG
42-
if: env.release_type != 'patch'
43-
id: changelog
44-
run: |
45-
# Match lines starting with "## vX.Y.Z " until the next "## "
46-
awk "/^## v${{ env.version }}[[:space:]]/{flag=1; next} /^## /{flag=0} flag" CHANGELOG.md > RELEASE_NOTES.md
47-
48-
echo "notes<<EOF" >> $GITHUB_ENV
49-
if [ "${{ env.release_type }}" = "major" ]; then
50-
echo "## 🚀 Major Release" >> $GITHUB_ENV
51-
elif [ "${{ env.release_type }}" = "minor" ]; then
52-
echo "## ✨ Minor Release" >> $GITHUB_ENV
53-
fi
54-
echo "" >> $GITHUB_ENV
55-
cat RELEASE_NOTES.md >> $GITHUB_ENV
56-
echo "EOF" >> $GITHUB_ENV
57-
58-
- name: Create GitHub Release
59-
if: env.release_type != 'patch'
60-
uses: softprops/action-gh-release@v2
61-
with:
62-
tag_name: v${{ env.version }}
63-
name: "Release v${{ env.version }}"
64-
body: ${{ env.notes }}
65-
env:
66-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+

.github/workflows/tag-after-merge.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,29 @@ jobs:
6161
git tag v${{ env.version }}
6262
git push origin v${{ env.version }}
6363
64-
64+
- name: Extract release notes from CHANGELOG
65+
if: env.release_type != 'patch'
66+
id: changelog
67+
run: |
68+
# Match lines starting with "## vX.Y.Z " until the next "## "
69+
awk "/^## v${{ env.version }}[[:space:]]/{flag=1; next} /^## /{flag=0} flag" CHANGELOG.md > RELEASE_NOTES.md
70+
71+
echo "notes<<EOF" >> $GITHUB_ENV
72+
if [ "${{ env.release_type }}" = "major" ]; then
73+
echo "## 🚀 Major Release" >> $GITHUB_ENV
74+
elif [ "${{ env.release_type }}" = "minor" ]; then
75+
echo "## ✨ Minor Release" >> $GITHUB_ENV
76+
fi
77+
echo "" >> $GITHUB_ENV
78+
cat RELEASE_NOTES.md >> $GITHUB_ENV
79+
echo "EOF" >> $GITHUB_ENV
80+
81+
- name: Create GitHub Release
82+
if: env.release_type != 'patch'
83+
uses: softprops/action-gh-release@v2
84+
with:
85+
tag_name: v${{ env.version }}
86+
name: "Release v${{ env.version }}"
87+
body: ${{ env.notes }}
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)