Skip to content

Commit 4eaca2e

Browse files
author
Lasim
committed
fix: enhance frontend release workflow with improved dependency installation and build handling
1 parent 8fa10e9 commit 4eaca2e

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

.github/workflows/frontend-release.yml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
- uses: actions/checkout@v4
2020
with:
2121
fetch-depth: 0
22+
token: ${{ secrets.APP_INSTALLATION_TOKEN }}
2223

2324
- name: git config
2425
run: |
@@ -31,17 +32,25 @@ jobs:
3132
node-version: 20
3233
cache: npm
3334

34-
# Install dependencies at root level for workspaces
35+
# Clean install dependencies
3536
- name: Install dependencies
3637
run: |
37-
rm -f package-lock.json
38-
npm install
38+
npm ci || {
39+
echo "npm ci failed, trying clean install with rollup fix..."
40+
rm -rf node_modules services/frontend/node_modules
41+
npm install --no-optional
42+
}
43+
44+
# Force install the missing rollup platform package if needed
45+
- name: Fix Rollup platform package
46+
run: |
47+
npm install @rollup/rollup-linux-x64-gnu --save-optional || echo "Rollup package already installed"
3948
4049
# Run release-it with conventional changelog
4150
- name: Prepare release
4251
working-directory: services/frontend
4352
env:
44-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
GITHUB_TOKEN: ${{ secrets.APP_INSTALLATION_TOKEN }}
4554
run: npm run release -- --ci --verbose --no-git.requireCleanWorkingDir
4655

4756
# Get the version after release-it has run
@@ -73,15 +82,20 @@ jobs:
7382
echo "Updated .env file:"
7483
grep VITE_DEPLOYSTACK_APP_VERSION .env
7584
76-
# Build the frontend with version env var
85+
# Build the frontend with version env var - with rollup fix
7786
- name: Build frontend
7887
working-directory: services/frontend
7988
env:
8089
VITE_DEPLOYSTACK_APP_VERSION: ${{ steps.package-version.outputs.current-version }}
8190
run: |
82-
# First try a clean install instead of using cached dependencies
83-
# npm run build || mkdir -p dist && echo '<html><body><h1>DeployStack Frontend</h1><p>Version ${{ steps.package-version.outputs.current-version }}</p></body></html>' > dist/index.html
84-
npm run build
91+
# Try build, if it fails due to rollup, try to fix and rebuild
92+
npm run build || {
93+
echo "Build failed, attempting rollup fix..."
94+
cd ../..
95+
npm install @rollup/rollup-linux-x64-gnu --save-optional --force
96+
cd services/frontend
97+
npm run build
98+
}
8599
ls -al ./dist
86100
87101
- name: Set up QEMU
@@ -109,4 +123,4 @@ jobs:
109123
build-args: |
110124
DEPLOYSTACK_FRONTEND_VERSION=${{ steps.package-version.outputs.current-version }}
111125
cache-from: type=gha
112-
cache-to: type=gha,mode=max
126+
cache-to: type=gha,mode=max

services/frontend/.release-it.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ module.exports = {
1414
},
1515
"hooks": {
1616
"before:init": ["npm run lint"],
17-
"after:bump": "npm run build",
17+
// Only run build when NOT in CI mode (i.e., during actual release merge)
18+
// During PR creation (CI=true), skip build to avoid rollup issues
19+
"after:bump": process.env.CI ? [] : ["npm run build"],
1820
"after:release": "echo 'Frontend ${version} released!'"
1921
},
2022
"plugins": {

0 commit comments

Comments
 (0)