name: Deploy # Builds site/ and deploys its Worker (the site at /hex and the files at # /hex/files: built installers and appcast, the dev notes, and the frozen # 2.3.1 bucket). Pull requests run no site check (CI is minimal; the deploy # builds the site and checks every download link). A push (or a dispatch) on # dev deploys the dev site (https://dev.anoma.ly/hex); on production, which # moves only by a fast-forward from dev, the production site # (https://anoma.ly/hex). The mode always follows the branch. Split like # Release (docs/releasing.md): # # - build runs repository code (bun install, site/scripts/build.ts) with no # environment and no secrets, and uploads the Worker's Build Output with a # SHA256SUMS whose digest it reports. # - deploy runs in the mode's environment (dev or production, each # admitting only its own branch) and mints a # short-lived Cloudflare token for that mode's Worker from the token issuer # after assuming the environment's role, github/hex- # (.github/release/cloudflare-token.sh). The AWS session is a step output # given only to the token step, and the token only to the Deploy step. It # checks out only .github/release/, verifies the artifact against that # digest, and runs only .github/release/deploy-site.sh, which pins the # Worker, routes, and bindings and deploys with the cf CLI locked in # .github/release/cf/. # - verify checks the live site and every download link without secrets. on: push: branches: [dev, production] paths: - "site/**" - ".github/workflows/deploy.yml" - ".github/release/deploy-site.sh" - ".github/release/cloudflare-token.sh" - ".github/release/cf/**" - ".github/release/install-linux.sh" - ".github/release/install-windows.ps1" - "packaging/macos/legacy-appcast.xml" workflow_dispatch: permissions: contents: read concurrency: group: site-${{ github.ref }} cancel-in-progress: true jobs: build: if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/production' runs-on: ubuntu-24.04 outputs: digest: ${{ steps.upload.outputs.digest }} defaults: run: working-directory: site steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: ref: ${{ github.sha }} persist-credentials: false - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 - run: bun install --frozen-lockfile # The checks the Installers and Legacy appcast workflows ran before they # uploaded these files to the bucket. The site now serves them, so a # broken installer or appcast fails the deploy instead. - name: Check the legacy appcast run: | python3 -c 'import sys, xml.dom.minidom; xml.dom.minidom.parse(sys.argv[1])' ../packaging/macos/legacy-appcast.xml grep -Fq '