From 372186d7a3cfdcf2ca1e6644b668845b11b2614e Mon Sep 17 00:00:00 2001 From: sck_0 Date: Sat, 7 Mar 2026 12:30:55 +0100 Subject: [PATCH] =?UTF-8?q?fix(pages):=20align=20with=20GitHub=20Pages=20+?= =?UTF-8?q?=20Vite=20guide=20=E2=80=94=20configure-pages,=20artifact=20roo?= =?UTF-8?q?t=20index,=20.nojekyll?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pages.yml | 23 ++++++++++++++--------- apps/web-app/vite.config.ts | 6 ------ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 1ed05e30..1ca61f2c 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -22,7 +22,8 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 - name: Setup Node uses: actions/setup-node@v4 @@ -44,17 +45,21 @@ jobs: env: VITE_BASE_PATH: /${{ github.event.repository.name }}/ - - name: SPA fallback for client-side routes - run: cp apps/web-app/dist/${{ github.event.repository.name }}/index.html apps/web-app/dist/${{ github.event.repository.name }}/404.html - - # GitHub serves artifact root at .../repo-name/ — put index at root so homepage loads - - name: Expose index at artifact root + - name: Prepare artifact for Pages (base path = /repo-name/) run: | - cp apps/web-app/dist/${{ github.event.repository.name }}/index.html apps/web-app/dist/index.html - cp apps/web-app/dist/${{ github.event.repository.name }}/404.html apps/web-app/dist/404.html + cd apps/web-app/dist + mkdir -p antigravity-awesome-skills + for f in *; do + [ "$f" != "index.html" ] && [ "$f" != "antigravity-awesome-skills" ] && mv "$f" antigravity-awesome-skills/ || true + done + cp index.html 404.html + touch .nojekyll + + - name: Configure GitHub Pages + uses: actions/configure-pages@v5 - name: Upload Pages artifact - uses: actions/upload-pages-artifact@3 + uses: actions/upload-pages-artifact@v4 with: path: apps/web-app/dist diff --git a/apps/web-app/vite.config.ts b/apps/web-app/vite.config.ts index 863bbc04..86f4a6a3 100644 --- a/apps/web-app/vite.config.ts +++ b/apps/web-app/vite.config.ts @@ -5,14 +5,8 @@ import refreshSkillsPlugin from './refresh-skills-plugin.js'; // https://vite.dev/config/ // VITE_BASE_PATH set in CI for GitHub Pages (e.g. /antigravity-awesome-skills/); default / for local dev const base = process.env.VITE_BASE_PATH ?? '/'; -const isGitHubPages = base !== '/'; export default defineConfig({ base, - // For GitHub Pages, emit files under the base path so the artifact root maps to the site root - build: { - outDir: isGitHubPages ? `dist${base}` : 'dist', - emptyOutDir: true, - }, plugins: [react(), refreshSkillsPlugin()], });