Deploy static site #94
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 static site | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - ".github/workflows/pages.yml" | |
| - "data/snapshot/v1.json" | |
| - "package.json" | |
| - "package-lock.json" | |
| - "src/**" | |
| - "web/**" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| env: | |
| DATABASE_URL: sqlite:./var/pages.db | |
| PUBLIC_SITE_URL: https://barretlee.github.io/agent-pulse/ | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - run: npm ci | |
| - name: Restore repository snapshot | |
| run: npm run db:snapshot -- restore | |
| - name: Fetch public repository metadata for the static export | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| metadata="$(gh api "repos/$GITHUB_REPOSITORY")" | |
| echo "GITHUB_STARS=$(jq -r '.stargazers_count' <<<"$metadata")" >> "$GITHUB_ENV" | |
| echo "GITHUB_FORKS=$(jq -r '.forks_count' <<<"$metadata")" >> "$GITHUB_ENV" | |
| echo "GITHUB_OPEN_ISSUES=$(jq -r '.open_issues_count' <<<"$metadata")" >> "$GITHUB_ENV" | |
| echo "GITHUB_METADATA_FETCHED_AT=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_ENV" | |
| - name: Export static site from restored data | |
| run: npm run export -- --skip-seed | |
| - name: Validate public content across every main tab | |
| run: npm run --silent public:validate -- --output="$RUNNER_TEMP/public-integrity.json" | |
| - name: Upload public integrity evidence | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: pages-public-integrity-${{ github.run_id }} | |
| path: ${{ runner.temp }}/public-integrity.json | |
| if-no-files-found: ignore | |
| retention-days: 7 | |
| - uses: actions/configure-pages@v6 | |
| - uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: dist | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |