fizzy-updated #26
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
| # Deploy fizzyed.it: this repo's static landing (docs/) + the fizzy browser app | |
| # built from a checkout of fizzyedit/fizzy (zig build web → site/app/). | |
| # | |
| # One-time repo setup: Settings → Pages → Build and deployment → Source: GitHub | |
| # Actions. Set the custom domain to fizzyed.it (docs/CNAME is copied into the | |
| # published artifact). The fizzy app source is public, so checking it out needs | |
| # no token. | |
| # | |
| # Rebuilds on: this repo's docs/ pushes, a repository_dispatch from | |
| # fizzyedit/fizzy (app source / new release), or a manual run. | |
| name: Deploy website | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "docs/**" | |
| - ".github/workflows/deploy-web.yml" | |
| repository_dispatch: | |
| types: [fizzy-updated] | |
| workflow_dispatch: | |
| concurrency: | |
| group: deploy-website | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| env: | |
| ZIG_VERSION: "0.16.0" | |
| # Branch or tag of fizzyedit/fizzy whose web app is published to /app/. | |
| # Set to a release tag (e.g. v0.0.18) if you want /app/ to track stable | |
| # releases instead of main. | |
| FIZZY_REF: "main" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout website (docs/, CNAME) | |
| uses: actions/checkout@v4 | |
| - name: Checkout fizzy app source | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: fizzyedit/fizzy | |
| ref: ${{ env.FIZZY_REF }} | |
| path: fizzy | |
| - name: Pre-create Zig global cache tmp/ | |
| run: mkdir -p "$GITHUB_WORKSPACE/zig-global-cache/tmp" | |
| - uses: mlugg/setup-zig@v2 | |
| with: | |
| version: ${{ env.ZIG_VERSION }} | |
| cache-key: ${{ hashFiles('fizzy/build.zig.zon') }} | |
| - name: Fetch dependencies (with retries) | |
| working-directory: fizzy | |
| env: | |
| ZIG_GLOBAL_CACHE_DIR: ${{ github.workspace }}/zig-global-cache | |
| run: | | |
| n=0 | |
| until [ "$n" -ge 5 ]; do | |
| zig build --fetch && break | |
| n=$((n+1)) | |
| echo "Fetch attempt $n failed, sleeping $((n*10))s before retry..." | |
| sleep $((n*10)) | |
| done | |
| if [ "$n" -ge 5 ]; then | |
| echo "All fetch attempts failed"; exit 1 | |
| fi | |
| - name: Build web app (ReleaseSafe) | |
| working-directory: fizzy | |
| env: | |
| ZIG_GLOBAL_CACHE_DIR: ${{ github.workspace }}/zig-global-cache | |
| run: zig build web -Doptimize=ReleaseSafe | |
| - name: Assemble site | |
| run: | | |
| mkdir -p site/app | |
| cp -R docs/. site/ | |
| cp -R fizzy/zig-out/web/. site/app/ | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: site | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |