mirror of
https://github.com/saltbo/zpan.git
synced 2026-08-29 00:01:42 +08:00
f701f4139a
Clears all 23 open CodeQL alerts:
- actions/missing-workflow-permissions (19, medium): add a top-level
least-privilege `permissions: contents: read` to ci.yml and the 7
deploy workflows. The one CI job that needs `packages: write` already
declares its own block; all deploys authenticate via static secrets
(no OIDC / id-token, no repo writes), so read is sufficient.
- js/insecure-randomness (1, high): `genPassword()` built share
passwords with Math.random(); switch to crypto.getRandomValues() over
the same unambiguous alphabet (length/charset/uniqueness preserved).
- js/incomplete-url-substring-sanitization (2, high): two test fetch
stubs routed on `String(url).includes('api.github.com')`; tighten to
`new URL(url).hostname === 'api.github.com'` — precise and no longer
flagged.
- js/stack-trace-exposure (1, medium): the E2E S3 mock echoed
error.message in 500 responses; log server-side and return a generic
body instead.
Verified: typecheck green; share-dialog/changelog/system.integration
tests pass.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
99 lines
3.6 KiB
YAML
99 lines
3.6 KiB
YAML
name: Deploy
|
|
|
|
# Fan-out dispatcher for ZPan's 6 deployment targets.
|
|
#
|
|
# On push to main (or manual trigger), a quick `detect` job probes which
|
|
# platform secrets are configured and sets one output per platform. Each
|
|
# platform's reusable child workflow (deploy-<target>.yml) is invoked only
|
|
# when its flag is `true` — platforms you haven't configured are shown as
|
|
# "Skipped", not failed.
|
|
#
|
|
# The upstream saltbo/zpan repo uses Cloudflare Workers Builds (the CF-side
|
|
# git integration) for its own deploys — this dispatcher is a no-op there.
|
|
# Forks get the full fan-out.
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: deploy-dispatch
|
|
cancel-in-progress: false
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
detect:
|
|
name: Detect configured platforms
|
|
runs-on: ubuntu-latest
|
|
if: github.repository != 'saltbo/zpan'
|
|
outputs:
|
|
cf: ${{ steps.probe.outputs.cf }}
|
|
lambda: ${{ steps.probe.outputs.lambda }}
|
|
vercel: ${{ steps.probe.outputs.vercel }}
|
|
netlify: ${{ steps.probe.outputs.netlify }}
|
|
azure: ${{ steps.probe.outputs.azure }}
|
|
cloud_run: ${{ steps.probe.outputs.cloud_run }}
|
|
steps:
|
|
- id: probe
|
|
# secrets are smuggled into env as booleans so the following shell
|
|
# can evaluate them; secrets.* is not allowed in job-level `if:`.
|
|
env:
|
|
CF: ${{ secrets.CLOUDFLARE_API_TOKEN != '' && secrets.CLOUDFLARE_ACCOUNT_ID != '' }}
|
|
LAMBDA: ${{ secrets.AWS_ACCESS_KEY_ID != '' && secrets.AWS_SECRET_ACCESS_KEY != '' && secrets.AWS_REGION != '' && secrets.TURSO_DATABASE_URL != '' }}
|
|
VERCEL: ${{ secrets.VERCEL_TOKEN != '' && secrets.VERCEL_ORG_ID != '' && secrets.VERCEL_PROJECT_ID != '' && secrets.TURSO_DATABASE_URL != '' }}
|
|
NETLIFY: ${{ secrets.NETLIFY_AUTH_TOKEN != '' && secrets.NETLIFY_SITE_ID != '' && secrets.TURSO_DATABASE_URL != '' }}
|
|
AZURE: ${{ secrets.AZURE_CREDENTIALS != '' && secrets.TURSO_DATABASE_URL != '' }}
|
|
CLOUD_RUN: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY != '' && secrets.GCP_PROJECT_ID != '' && secrets.TURSO_DATABASE_URL != '' }}
|
|
run: |
|
|
configured=""
|
|
for p in CF LAMBDA VERCEL NETLIFY AZURE CLOUD_RUN; do
|
|
v=$(eval echo \$$p)
|
|
key=$(echo "$p" | tr '[:upper:]' '[:lower:]')
|
|
echo "${key}=${v}" >> "$GITHUB_OUTPUT"
|
|
[ "$v" = "true" ] && configured="$configured $p"
|
|
done
|
|
if [ -z "$configured" ]; then
|
|
echo "::notice::No deploy targets configured. Add secrets under Settings → Secrets and variables → Actions. See README for per-platform requirements."
|
|
else
|
|
echo "### 🚀 Dispatching to:$configured" >> "$GITHUB_STEP_SUMMARY"
|
|
fi
|
|
|
|
cloudflare:
|
|
needs: detect
|
|
if: needs.detect.outputs.cf == 'true'
|
|
uses: ./.github/workflows/deploy-cloudflare.yml
|
|
secrets: inherit
|
|
|
|
aws-lambda:
|
|
needs: detect
|
|
if: needs.detect.outputs.lambda == 'true'
|
|
uses: ./.github/workflows/deploy-aws-lambda.yml
|
|
secrets: inherit
|
|
|
|
vercel:
|
|
needs: detect
|
|
if: needs.detect.outputs.vercel == 'true'
|
|
uses: ./.github/workflows/deploy-vercel.yml
|
|
secrets: inherit
|
|
|
|
netlify:
|
|
needs: detect
|
|
if: needs.detect.outputs.netlify == 'true'
|
|
uses: ./.github/workflows/deploy-netlify.yml
|
|
secrets: inherit
|
|
|
|
azure:
|
|
needs: detect
|
|
if: needs.detect.outputs.azure == 'true'
|
|
uses: ./.github/workflows/deploy-azure.yml
|
|
secrets: inherit
|
|
|
|
cloud-run:
|
|
needs: detect
|
|
if: needs.detect.outputs.cloud_run == 'true'
|
|
uses: ./.github/workflows/deploy-cloud-run.yml
|
|
secrets: inherit
|