feat: deploy web app to GitHub Pages

This commit is contained in:
sck_0
2026-03-07 12:23:18 +01:00
parent 9ce7860cc9
commit f1842f470e
5 changed files with 80 additions and 1 deletions

64
.github/workflows/pages.yml vendored Normal file
View File

@@ -0,0 +1,64 @@
# Build and deploy the web app to GitHub Pages.
# Enable in repo: Settings → Pages → Source: GitHub Actions.
# Site URL: https://<owner>.github.io/<repo>/
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

View File

@@ -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://<owner>.github.io/antigravity-awesome-skills/`.
## Contributing
- Add new skills under `skills/<skill-name>/SKILL.md`.

View File

@@ -5,7 +5,7 @@ import { BookOpen, Github } from 'lucide-react';
function App(): React.ReactElement {
return (
<Router>
<Router basename={import.meta.env.BASE_URL.replace(/\/$/, '') || '/'}>
<div className="min-h-screen bg-slate-50 dark:bg-slate-950 text-slate-900 dark:text-slate-50">
<header className="sticky top-0 z-50 w-full border-b border-slate-200 dark:border-slate-800 bg-white/80 dark:bg-slate-950/80 backdrop-blur supports-[backdrop-filter]:bg-white/60">
<div className="container flex h-14 max-w-screen-2xl items-center mx-auto px-4">

1
apps/web-app/src/vite-env.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
/// <reference types="vite/client" />

View File

@@ -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()],
});