Skip to content

Commit d50e10a

Browse files
committed
fix: improve frontend release workflow with enhanced dependency installation and release notes extraction
1 parent bc015af commit d50e10a

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

.github/workflows/frontend-release-pr.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,46 +23,54 @@ permissions:
2323
jobs:
2424
releaseIt:
2525
runs-on: ubuntu-latest
26-
defaults:
27-
run:
28-
working-directory: services/frontend
2926
steps:
3027
- uses: actions/checkout@v4
3128
with:
3229
fetch-depth: 0
33-
# Use the app token for checkout as well
3430
token: ${{ secrets.APP_INSTALLATION_TOKEN }}
31+
3532
- name: git config
3633
run: |
3734
git config user.name "${GITHUB_ACTOR}"
3835
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
36+
3937
- name: Setup node
4038
uses: actions/setup-node@v4
4139
with:
4240
node-version: 20
4341
cache: npm
44-
- run: npm ci
42+
43+
# Try normal install first, fallback to clean install only if needed
44+
- name: Install dependencies
45+
run: |
46+
npm ci || {
47+
echo "npm ci failed, trying clean install with rollup fix..."
48+
rm -rf node_modules services/frontend/node_modules
49+
npm install --no-optional
50+
}
51+
4552
- name: Prepare release
53+
working-directory: services/frontend
4654
env:
4755
GITHUB_TOKEN: ${{ secrets.APP_INSTALLATION_TOKEN }}
4856
TYPE_ARG: ${{ fromJSON('{"patch":"patch", "minor":"minor", "major":"major"}')[github.event.inputs.type] }}
4957
BETA_ARG: ${{ github.event.inputs.beta == 'true' && '--preRelease=beta' || '' }}
5058
run: npm run release -- $TYPE_ARG --ci --verbose --no-git.push --no-git.commit --no-git.tag --no-github $BETA_ARG
59+
5160
- name: get-npm-version
5261
id: package-version
5362
uses: martinbeentjes/npm-get-version-action@main
5463
with:
5564
path: services/frontend
65+
5666
- name: Extract release notes
5767
id: extract-release-notes
68+
working-directory: services/frontend
5869
run: |
59-
# Get the current version from the package.json in the current working directory
6070
VERSION=$(cat package.json | grep '"version"' | cut -d'"' -f4)
6171
echo "Extracting release notes for version $VERSION"
6272
63-
# Extract the changelog section for this version
6473
if [ -f CHANGELOG.md ]; then
65-
# Look for the version header and extract content until the next version or end of file
6674
RELEASE_NOTES=$(awk -v version="$VERSION" '
6775
BEGIN { found=0; content="" }
6876
/^##? [0-9]+\.[0-9]+\.[0-9]+/ {
@@ -74,10 +82,8 @@ jobs:
7482
END { print content }
7583
' CHANGELOG.md)
7684
77-
# Clean up empty markdown links and remove empty lines
7885
CLEAN_NOTES=$(echo "$RELEASE_NOTES" | sed 's/(\[\]([^)]*))//g' | sed '/^$/d')
7986
80-
# Save to output
8187
echo "release_notes<<EOF" >> $GITHUB_OUTPUT
8288
echo "$CLEAN_NOTES" >> $GITHUB_OUTPUT
8389
echo "EOF" >> $GITHUB_OUTPUT
@@ -88,12 +94,11 @@ jobs:
8894
echo "No CHANGELOG.md found"
8995
echo "release_notes=" >> $GITHUB_OUTPUT
9096
fi
91-
working-directory: services/frontend
97+
9298
- name: Create pull request
9399
uses: peter-evans/create-pull-request@v7
94100
id: cpr
95101
with:
96-
# This is the key change - use the app token
97102
token: ${{ secrets.APP_INSTALLATION_TOKEN }}
98103
branch: frontend-release
99104
delete-branch: true
@@ -127,6 +132,7 @@ jobs:
127132
release
128133
automated pr
129134
draft: false
135+
130136
- name: Show PR link
131137
if: ${{ steps.cpr.outputs.pull-request-url }}
132138
run: |

0 commit comments

Comments
 (0)