Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/preview-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build Preview

on:
pull_request:
branches: [main]

permissions:
contents: read

jobs:
build:
name: Build site
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Build GAP website
run: npm run build

- name: Save PR metadata
run: echo "${{ github.event.pull_request.number }}" > _site/.pr-number

- name: Upload build artifact
uses: actions/upload-artifact@v7
with:
name: preview-build
path: _site
retention-days: 1
37 changes: 37 additions & 0 deletions .github/workflows/preview-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Deploy Preview

on:
workflow_run:
workflows: ["Build Preview"]
types: [completed]

permissions:
contents: read
actions: read
deployments: write

jobs:
deploy:
name: Deploy preview to Cloudflare
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }}

steps:
- name: Download build artifact
uses: actions/download-artifact@v8
with:
name: preview-build
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
path: _site

- name: Read PR number
id: pr
run: echo "number=$(cat _site/.pr-number)" >> "$GITHUB_OUTPUT"

- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v4
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy _site --project-name=gaps --branch=pr-${{ steps.pr.outputs.number }}
8 changes: 8 additions & 0 deletions wrangler.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "gaps",
"compatibility_date": "2026-05-23",
"assets": {
"directory": "./_site"
}
}
Loading