playground woes #27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to GitHub Pages | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - name: Build WASM | |
| run: | | |
| GOOS=js GOARCH=wasm go build -ldflags="-s -w" -trimpath -o gnata.wasm ./wasm/ | |
| cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" wasm_exec.js | |
| # LSP WASM ships pre-built in @gnata-sqlite/react | |
| cp react/wasm/gnata-lsp.wasm gnata-lsp.wasm | |
| cp react/wasm/lsp-wasm_exec.js lsp-wasm_exec.js | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build React widget | |
| run: cd react && pnpm run build | |
| # Build docs site (Fumadocs static export) | |
| - name: Copy WASM to website | |
| run: cp gnata.wasm gnata-lsp.wasm wasm_exec.js lsp-wasm_exec.js website/public/ | |
| - name: Build website | |
| run: cd website && pnpm build | |
| env: | |
| GITHUB_PAGES: true | |
| # Build playground (Vite static build) | |
| - name: Copy WASM to playground | |
| run: cp gnata.wasm gnata-lsp.wasm wasm_exec.js lsp-wasm_exec.js playground/public/ | |
| - name: Build playground | |
| run: cd playground && pnpm build | |
| env: | |
| GITHUB_PAGES: true | |
| # Combine: docs site at root, playground nested at /playground/ | |
| - name: Assemble site | |
| run: | | |
| mkdir -p _site | |
| cp -r website/out/* _site/ | |
| mkdir -p _site/playground | |
| cp -r playground/dist/* _site/playground/ | |
| # SPA fallback: copy index.html to each playground route | |
| # so GitHub Pages serves the app shell for direct navigation | |
| for route in sqlite gnata; do | |
| mkdir -p "_site/playground/${route}" | |
| cp playground/dist/index.html "_site/playground/${route}/index.html" | |
| done | |
| - uses: actions/upload-pages-artifact@v3 | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deploy.outputs.page_url }} | |
| steps: | |
| - id: deploy | |
| uses: actions/deploy-pages@v4 |