@@ -26,13 +26,21 @@ jobs:
2626 with :
2727 fetch-depth : 0
2828
29- - name : Setup Node
30- uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
31- with :
32- node-version-file : ' .nvmrc'
29+ - name : Setup Project
30+ uses : ./.github/actions/setup-node-yarn
3331
34- - name : Enable corepack
35- run : corepack enable
32+ - name : Extract release notes from Unreleased section
33+ id : changelog
34+ run : |
35+ NOTES=$(awk '/## \[Unreleased\]/ {flag=1; next} /^## \[/ {flag=0} flag && NF {print}' CHANGELOG.md)
36+ if [ -z "$NOTES" ] || [ -z "$(echo "$NOTES" | tr -d '[:space:]')" ]; then
37+ echo "Error: No release notes found in the [Unreleased] section of CHANGELOG.md"
38+ echo "Please add release notes before creating a release."
39+ exit 1
40+ fi
41+ echo "notes<<EOF" >> $GITHUB_OUTPUT
42+ echo "$NOTES" >> $GITHUB_OUTPUT
43+ echo "EOF" >> $GITHUB_OUTPUT
3644
3745 - name : Bump version and update CHANGELOG
3846 id : bump
@@ -41,18 +49,18 @@ jobs:
4149 echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
4250 sed -i "s/## \[Unreleased\]/## [Unreleased]\n\n## [$NEW_VERSION] - $(date +%Y-%m-%d)/" CHANGELOG.md
4351
44- - name : Extract release notes
45- id : changelog
52+ - name : Check if release already exists
4653 run : |
47- NOTES=$(awk '/## \[Unreleased\]/ {flag=1; next} /^## \[/ {flag=0} flag {print}' CHANGELOG.md)
48- echo "notes<<EOF" >> $GITHUB_OUTPUT
49- echo "$NOTES" >> $GITHUB_OUTPUT
50- echo "EOF" >> $GITHUB_OUTPUT
54+ if git ls-remote --tags origin | grep -q "refs/tags/${{ steps.bump.outputs.version }}$"; then
55+ echo "Error: Release tag ${{ steps.bump.outputs.version }} already exists"
56+ echo "Please check existing releases or use a different version bump type."
57+ exit 1
58+ fi
5159
5260 - name : Build and pack
5361 id : pack
5462 run : |
55- yarn install
63+ yarn install --immutable
5664 yarn prepare
5765 yarn pack --filename mendix-native-${{ steps.bump.outputs.version }}.tgz
5866 echo "tgz=mendix-native-${{ steps.bump.outputs.version }}.tgz" >> $GITHUB_OUTPUT
0 commit comments