Publish Docs and Web #48
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: Publish Docs and Web | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Zig | |
| uses: mlugg/setup-zig@v2 | |
| with: | |
| version: '0.16.0' | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y make | |
| - name: Generate documentation | |
| run: make docs | |
| - name: Build Wasm playground | |
| run: zig build wasm | |
| - name: Assemble site | |
| run: | | |
| mkdir -p site/api | |
| cp web/index.html web/main.js web/style.css logo.svg site/ | |
| cp zig-out/web/zodd.wasm site/ | |
| cp -r docs/api/* site/api/ | |
| - name: Configure GitHub pages | |
| uses: actions/configure-pages@v5 | |
| - name: Upload site 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 |