diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 00000000..0fa56cde --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,64 @@ +# Build and deploy the web app to GitHub Pages. +# Enable in repo: Settings → Pages → Source: GitHub Actions. +# Site URL: https://.github.io// + +name: Deploy Web App to GitHub Pages + +on: + push: + branches: ["main", "master"] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "lts/*" + cache: "npm" + + - name: Install root dependencies + run: npm ci + + - name: Prepare web app (index + skills) + run: npm run app:setup + + - name: Install web-app dependencies + run: cd apps/web-app && npm ci + + - name: Build web app for GitHub Pages + run: cd apps/web-app && npm run build + 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 + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@3 + with: + path: apps/web-app/dist + + deploy: + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deploy.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deploy + uses: actions/deploy-pages@4 diff --git a/README.md b/README.md index d3e273fc..ce7f5152 100644 --- a/README.md +++ b/README.md @@ -314,6 +314,8 @@ Counts change as new skills are added. For the current full registry, see [CATAL The web app is the fastest way to navigate a large repository like this. +**Run locally:** + ```bash npm run app:install npm run app:dev @@ -321,6 +323,8 @@ npm run app:dev That will copy the generated skill index into `apps/web-app/public/skills.json`, mirror the current `skills/` tree into `apps/web-app/public/skills/`, and start the Vite development server. +**Hosted on GitHub Pages:** The same app is deployed automatically on every push to `main`. Enable it once in the repo: **Settings → Pages → Build and deployment → Source: GitHub Actions**. The site will be available at `https://.github.io/antigravity-awesome-skills/`. + ## Contributing - Add new skills under `skills//SKILL.md`. diff --git a/apps/web-app/src/App.tsx b/apps/web-app/src/App.tsx index c842d471..dfb60123 100644 --- a/apps/web-app/src/App.tsx +++ b/apps/web-app/src/App.tsx @@ -5,7 +5,7 @@ import { BookOpen, Github } from 'lucide-react'; function App(): React.ReactElement { return ( - +
diff --git a/apps/web-app/src/vite-env.d.ts b/apps/web-app/src/vite-env.d.ts new file mode 100644 index 00000000..11f02fe2 --- /dev/null +++ b/apps/web-app/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/apps/web-app/vite.config.ts b/apps/web-app/vite.config.ts index e7f0281d..863bbc04 100644 --- a/apps/web-app/vite.config.ts +++ b/apps/web-app/vite.config.ts @@ -3,6 +3,16 @@ import react from '@vitejs/plugin-react'; 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()], });