mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-20 01:08:31 +03:00
7bac5bad02
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.
37 lines
1.2 KiB
YAML
37 lines
1.2 KiB
YAML
name: Upload a release artifact
|
|
description: Writes SHA256SUMS for a directory, uploads it, and outputs the manifest digest.
|
|
inputs:
|
|
name:
|
|
description: Artifact name, <stage>-<target>
|
|
required: true
|
|
path:
|
|
description: Directory to upload
|
|
required: true
|
|
retention-days:
|
|
description: Days to keep the artifact (0 keeps the repository default)
|
|
required: false
|
|
default: "0"
|
|
include-hidden-files:
|
|
description: Include hidden files (deploy Build Output carries .vite metadata)
|
|
required: false
|
|
default: "false"
|
|
outputs:
|
|
digest:
|
|
description: SHA-256 of the artifact's SHA256SUMS
|
|
value: ${{ steps.checksum.outputs.digest }}
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- id: checksum
|
|
shell: bash
|
|
run: echo "digest=$(bash "${GITHUB_ACTION_PATH//\\//}/../write-checksums.sh" "$UPLOAD_PATH")" >> "$GITHUB_OUTPUT"
|
|
env:
|
|
UPLOAD_PATH: ${{ inputs.path }}
|
|
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
name: ${{ inputs.name }}
|
|
path: ${{ inputs.path }}
|
|
retention-days: ${{ inputs.retention-days }}
|
|
include-hidden-files: ${{ inputs.include-hidden-files }}
|
|
if-no-files-found: error
|