opencode/.github/release/download/action.yml
Dax Raad 7bac5bad02 fix(deploy): run Cloudflare deploys from verified artifacts behind pinned targets
Repository code outside .github/ needs no review, but every deploy job held a
Cloudflare token strong enough to write any Worker on the account (the data
sync Workflow PUT has no per-Worker permission). A dev merge could therefore
overwrite production Workers.

Split each service into a build job with no environment, secrets, or OIDC token
that uploads a SHA256SUMS artifact, and a deploy job in dev|production that
checks out only .github/release/, verifies the artifact against the build job's
digest, installs the cf/wrangler CLI pinned here, and runs only deploy-*.sh.

The deploy scripts treat the artifact as data and refuse it unless its resolved
config equals the pinned target in .github/release/targets/ exactly: Worker
names, routes, custom domains, crons, Workflow names, and bindings. For cf
services the pinned config is what cf reads. That is what makes an account-wide
token safe, and it keeps production out of reach of a dev merge.

Adds the cf 1.0.0-beta.12 and wrangler 4.110.0 lockfiles the deploy jobs
install with npm ci --ignore-scripts.
2026-11-11 04:51:07 -05:00

26 lines
954 B
YAML

name: Download release artifacts
description: Downloads artifacts into $RUNNER_TEMP/in/<name> and verifies each against its SHA256SUMS.
inputs:
pattern:
description: Artifact name pattern
required: true
digests:
description: Space-separated name=digest pairs for artifacts made by sign jobs, from their job outputs
required: false
default: ""
require-digests:
description: Require every artifact to match a reported digest (deploy jobs set this)
required: false
default: "false"
runs:
using: composite
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: ${{ inputs.pattern }}
path: ${{ runner.temp }}/in
- shell: bash
run: bash "${GITHUB_ACTION_PATH//\\//}/../verify-artifacts.sh" "$RUNNER_TEMP/in"
env:
OPENCODE_DIGESTS: ${{ inputs.digests }}
OPENCODE_REQUIRE_DIGESTS: ${{ inputs.require-digests }}