Skip to content

Commit 11a8c6e

Browse files
chore: enhance GitHub Actions with caching and release notes validation
1 parent 6ebb8e3 commit 11a8c6e

2 files changed

Lines changed: 22 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
1717
with:
1818
node-version-file: '.nvmrc'
19+
cache: yarn
1920

2021
- name: Enable corepack
2122
run: corepack enable

.github/workflows/release.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,43 @@ jobs:
3030
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
3131
with:
3232
node-version-file: '.nvmrc'
33+
cache: yarn
3334

3435
- name: Enable corepack
3536
run: corepack enable
3637

38+
- name: Extract release notes from Unreleased section
39+
id: changelog
40+
run: |
41+
NOTES=$(awk '/## \[Unreleased\]/ {flag=1; next} /^## \[/ {flag=0} flag && NF {print}' CHANGELOG.md)
42+
if [ -z "$NOTES" ] || [ -z "$(echo "$NOTES" | tr -d '[:space:]')" ]; then
43+
echo "Error: No release notes found in the [Unreleased] section of CHANGELOG.md"
44+
echo "Please add release notes before creating a release."
45+
exit 1
46+
fi
47+
echo "notes<<EOF" >> $GITHUB_OUTPUT
48+
echo "$NOTES" >> $GITHUB_OUTPUT
49+
echo "EOF" >> $GITHUB_OUTPUT
50+
3751
- name: Bump version and update CHANGELOG
3852
id: bump
3953
run: |
4054
NEW_VERSION=$(npm version ${{ github.event.inputs.version }} --no-git-tag-version)
4155
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
4256
sed -i "s/## \[Unreleased\]/## [Unreleased]\n\n## [$NEW_VERSION] - $(date +%Y-%m-%d)/" CHANGELOG.md
4357
44-
- name: Extract release notes
45-
id: changelog
58+
- name: Check if release already exists
4659
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
60+
if git ls-remote --tags origin | grep -q "refs/tags/${{ steps.bump.outputs.version }}$"; then
61+
echo "Error: Release tag ${{ steps.bump.outputs.version }} already exists"
62+
echo "Please check existing releases or use a different version bump type."
63+
exit 1
64+
fi
5165
5266
- name: Build and pack
5367
id: pack
5468
run: |
55-
yarn install
69+
yarn install --immutable
5670
yarn prepare
5771
yarn pack --filename mendix-native-${{ steps.bump.outputs.version }}.tgz
5872
echo "tgz=mendix-native-${{ steps.bump.outputs.version }}.tgz" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)