Deploy Website to GitHub Pages #56
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 Website to GitHub Pages | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - ".github/workflows/github-pages.yml" | |
| - "package.json" | |
| - "bun.lock" | |
| - "tsconfig*.json" | |
| - "packages/shared/**" | |
| - "packages/agent/**" | |
| - "packages/website/**" | |
| - "scripts/**" | |
| # Rebuild on a schedule so approved Directus edits reach the public site | |
| # without a code push. Stewards publish in Directus; this picks it up. | |
| schedule: | |
| - cron: "0 * * * *" | |
| # Lets a Directus flow (or an operator) trigger an immediate rebuild: | |
| # gh api repos/:owner/:repo/dispatches -f event_type=operational-content-updated | |
| repository_dispatch: | |
| types: [operational-content-updated] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: "1.3.10" | |
| - name: Configure GitHub Pages | |
| uses: actions/configure-pages@v6 | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| # The agent may be scaled to zero; give it a chance to wake before the | |
| # build fetches the snapshot, and fail loudly if it never answers. | |
| - name: Wait for operational content API | |
| run: bun scripts/wait-for-http.ts "${{ vars.AGENT_READY_URL || 'https://agent.greenpill.network/ready' }}" 120000 | |
| - name: Build website | |
| run: bun run build:website | |
| env: | |
| # Build against approved live operational content instead of the | |
| # checked-in snapshot fallback. If this fetch fails the build fails, | |
| # which leaves the currently deployed site untouched. | |
| OPERATIONAL_CONTENT_SNAPSHOT_URL: ${{ vars.OPERATIONAL_CONTENT_SNAPSHOT_URL || 'https://agent.greenpill.network/content/public-snapshot' }} | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: packages/website/dist | |
| 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@v5 |