better readmes and apis #32
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: Install TinyGo | |
| run: | | |
| wget -q https://github.com/tinygo-org/tinygo/releases/download/v0.40.1/tinygo_0.40.1_amd64.deb -O /tmp/tinygo.deb | |
| sudo dpkg -i /tmp/tinygo.deb | |
| - name: Build WASM | |
| run: make wasm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Stage WASM into react package | |
| run: make stage-wasm-only | |
| - 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 |