Skip to content

Commit 163faeb

Browse files
author
Davi Castro Samora
committed
fix: resolve build errors and improve GitHub Actions workflow
1 parent 99d65a8 commit 163faeb

3 files changed

Lines changed: 49 additions & 12 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,50 @@ jobs:
3131
cache: 'npm'
3232
registry-url: 'https://registry.npmjs.org'
3333

34-
- name: Configure npm for retries
34+
- name: Configure npm for better reliability
3535
run: |
36-
npm config set fetch-retries 5
37-
npm config set fetch-retry-mintimeout 20000
38-
npm config set fetch-retry-maxtimeout 120000
36+
npm config set fetch-retries 10
37+
npm config set fetch-retry-mintimeout 30000
38+
npm config set fetch-retry-maxtimeout 300000
39+
npm config set fetch-timeout 600000
40+
npm config set registry https://registry.npmjs.org/
41+
npm config set maxsockets 1
42+
npm config set prefer-offline true
3943
40-
- name: Install dependencies with retry
44+
- name: Clear npm cache
45+
run: npm cache clean --force
46+
47+
- name: Install dependencies with retry and fallback
4148
run: |
42-
for i in {1..3}; do
43-
npm ci --legacy-peer-deps && break || {
44-
echo "Attempt $i failed, retrying in 30 seconds..."
45-
sleep 30
46-
}
49+
for i in {1..5}; do
50+
echo "Attempt $i of 5..."
51+
if npm ci --legacy-peer-deps --no-audit --no-fund --verbose; then
52+
echo "Dependencies installed successfully!"
53+
break
54+
else
55+
echo "Attempt $i failed"
56+
if [ $i -lt 5 ]; then
57+
echo "Waiting 60 seconds before retry..."
58+
sleep 60
59+
echo "Clearing npm cache..."
60+
npm cache clean --force
61+
else
62+
echo "All attempts failed. Trying with npm install as fallback..."
63+
npm install --legacy-peer-deps --no-audit --no-fund
64+
fi
65+
fi
4766
done
4867
4968
- name: Build project
5069
run: npm run build:production
70+
env:
71+
NODE_ENV: production
72+
CI: true
5173

5274
- name: Add .nojekyll file
53-
run: touch out/.nojekyll
75+
run: |
76+
mkdir -p out
77+
touch out/.nojekyll
5478
5579
- name: Deploy to GitHub Pages
5680
uses: peaceiris/actions-gh-pages@v3

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,23 @@ Thumbs.db
3333
npm-debug.log*
3434
yarn-debug.log*
3535
yarn-error.log*
36+
lerna-debug.log*
37+
38+
# Runtime data
39+
pids
40+
*.pid
41+
*.seed
42+
*.pid.lock
3643

3744
# TypeScript
3845
*.tsbuildinfo
3946

47+
# npm cache
48+
.npm
49+
50+
# ESLint cache
51+
.eslintcache
52+
4053
# Miscellaneous
4154
*.log
4255
*.md

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"format": "npx biome format --write",
1212
"predeploy": "npm run build",
1313
"deploy": "gh-pages -d out --dotfiles",
14-
"build:production": "cross-env NODE_ENV=production npm run build"
14+
"build:production": "npm run build"
1515
},
1616
"dependencies": {
1717
"@react-three/drei": "^9.114.0",

0 commit comments

Comments
 (0)