hex/.github/workflows/site.yml
Dax Raad ea00b65602 fix(site): deploy the site from a secretless build through a locked script
Security finding #528: Site ran site/ code (bun install, build.ts, vite)
in the release environment with a Cloudflare token that can write every
Worker. Site deploy now builds without an environment or secret, uploads
the Build Output with its SHA256SUMS digest, and deploys it from a job
that checks out only .github/release/, verifies the digest, and runs
deploy-site.sh: it refuses any Worker, route, or binding other than the
mode's site Worker and deploys with the cf CLI locked in
.github/release/cf/. Legacy appcast checks out only .github/release/ and
the appcast, and r2-put.sh moves under the boundary.

The deploy token is now hex-site-deploy (Scripts + anoma.ly Routes, no
R2) and the appcast key hex-r2-production-files (one bucket).
2026-10-27 21:18:42 -04:00

58 lines
1.5 KiB
YAML

name: Site
# Builds site/ and checks every download link on pull requests; a push to dev
# deploys dev (https://dev.anoma.ly/hex). Production (https://anoma.ly/hex)
# deploys after a stable Release publishes, or by dispatching this workflow
# with mode production from production.
on:
pull_request:
paths:
- "site/**"
- ".github/workflows/site.yml"
- ".github/workflows/site-deploy.yml"
- ".github/release/deploy-site.sh"
- ".github/release/cf/**"
push:
branches: [dev]
paths:
- "site/**"
- ".github/workflows/site.yml"
- ".github/workflows/site-deploy.yml"
- ".github/release/deploy-site.sh"
- ".github/release/cf/**"
workflow_dispatch:
inputs:
mode:
type: choice
options: [dev, production]
default: dev
permissions:
contents: read
concurrency:
group: site-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
defaults:
run:
working-directory: site
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun run build
- run: bun run check:downloads
deploy:
if: github.event_name == 'push' || inputs.mode == 'dev' || github.ref == 'refs/heads/production'
uses: ./.github/workflows/site-deploy.yml
with:
mode: ${{ github.event_name == 'workflow_dispatch' && inputs.mode || 'dev' }}
secrets: inherit