|
38 | 38 | run: | |
39 | 39 | # Ensure required native deps for image optimization binaries (pngquant) are present |
40 | 40 | sudo apt-get update && sudo apt-get install -y libpng-dev build-essential pkg-config || true |
| 41 | + # Avoid installing optional native binaries that sometimes fail in CI |
| 42 | + export npm_config_optional=false |
41 | 43 | if [ -f package-lock.json ]; then npm ci; else npm install; fi |
42 | 44 |
|
43 | 45 | - name: Determine deploy subpath |
|
73 | 75 | export PUBLIC_URL="$DEPLOY_BASE" |
74 | 76 | export VITE_BASE_PATH="$DEPLOY_BASE" |
75 | 77 | echo "Building with DEPLOY_BASE=$DEPLOY_BASE" |
| 78 | + |
| 79 | + # Print the expected GitHub Pages URL to make verification easier |
| 80 | + OWNER=${GITHUB_REPOSITORY%%/*} |
| 81 | + REPO=${GITHUB_REPOSITORY#*/} |
| 82 | + # strip possible .git (unlikely in GITHUB_REPOSITORY but safe) |
| 83 | + REPO=$(basename -s .git "$REPO") |
| 84 | + # Construct URL without trailing slash |
| 85 | + EXPECTED_URL="https://${OWNER}.github.io/${REPO}${DEPLOY_BASE%/}" |
| 86 | + echo "Expected Pages URL: $EXPECTED_URL" |
76 | 87 |
|
77 | 88 | npm run build |
78 | 89 | # Ensure SPA routes work on GitHub Pages by providing a 404 fallback |
@@ -110,6 +121,8 @@ jobs: |
110 | 121 | run: | |
111 | 122 | # Ensure required native deps for image optimization binaries (pngquant) are present |
112 | 123 | sudo apt-get update && sudo apt-get install -y libpng-dev build-essential pkg-config || true |
| 124 | + # Avoid installing optional native binaries that sometimes fail in CI |
| 125 | + export npm_config_optional=false |
113 | 126 | if [ -f package-lock.json ]; then npm ci; else npm install; fi |
114 | 127 |
|
115 | 128 | - name: Determine deploy subpath |
@@ -145,6 +158,12 @@ jobs: |
145 | 158 | export PUBLIC_URL="$DEPLOY_BASE" |
146 | 159 | export VITE_BASE_PATH="$DEPLOY_BASE" |
147 | 160 | echo "Building with DEPLOY_BASE=$DEPLOY_BASE" |
| 161 | + # Print the expected GitHub Pages URL to make verification easier |
| 162 | + OWNER=${GITHUB_REPOSITORY%%/*} |
| 163 | + REPO=${GITHUB_REPOSITORY#*/} |
| 164 | + REPO=$(basename -s .git "$REPO") |
| 165 | + EXPECTED_URL="https://${OWNER}.github.io/${REPO}${DEPLOY_BASE%/}" |
| 166 | + echo "Expected Pages URL: $EXPECTED_URL" |
148 | 167 |
|
149 | 168 | npm run build |
150 | 169 | # Ensure SPA routes work on GitHub Pages by providing a 404 fallback |
|
0 commit comments