diff --git a/.github/workflows/platform-deploy-staging.yml b/.github/workflows/platform-deploy-staging.yml index 6e72c6864..3e35e4004 100644 --- a/.github/workflows/platform-deploy-staging.yml +++ b/.github/workflows/platform-deploy-staging.yml @@ -2,6 +2,24 @@ name: Deploy Platform Staging on: workflow_dispatch: + push: + branches: [main] + # Same filter as platform-ci.yml: workers bundle the SDK, so SDK-only + # changes must redeploy staging too. + paths: + - 'platform/**' + - 'packages/**' + - 'package.json' + - 'pnpm-lock.yaml' + - 'pnpm-workspace.yaml' + - 'vite.config.ts' + - '.github/workflows/platform-*.yml' + +concurrency: + # One running deploy plus at most one pending. Never interrupt a deploy + # between the api migration and the workers that depend on it. + group: platform-deploy-staging + cancel-in-progress: false permissions: {} diff --git a/.github/workflows/platform-smoke-test.yml b/.github/workflows/platform-smoke-test.yml index ce07c5f5e..71e798069 100644 --- a/.github/workflows/platform-smoke-test.yml +++ b/.github/workflows/platform-smoke-test.yml @@ -1,6 +1,8 @@ name: Platform Smoke Test on: + schedule: + - cron: '0 0 * * *' # daily at 8am SGT (midnight UTC) workflow_dispatch: permissions: {} diff --git a/platform/README.md b/platform/README.md index a5e9bd735..f7ac71832 100644 --- a/platform/README.md +++ b/platform/README.md @@ -73,7 +73,7 @@ Paths in this file are relative to `platform/` unless they begin with `../`. For The `@voidcloud/platform` workspace package retains the dashboard-only `dev` and `build` scripts. Dashboard deploys run after the platform workers in the platform deploy pipeline. -**Manual deploys only. Do not ask to push or deploy.** +**Production deploys are manual only; staging deploys on every push to `main`.** See [`meta/operations.md`](./meta/operations.md#github-actions) for the workflow triggers. Do not ask to push or deploy. ## Local Development diff --git a/platform/meta/operations.md b/platform/meta/operations.md index af845f404..964cfa20e 100644 --- a/platform/meta/operations.md +++ b/platform/meta/operations.md @@ -27,10 +27,10 @@ Five Cloudflare Workers: Two fully isolated environments. Each has its own CF resources (KV, R2, dispatch namespace, analytics engine) and a separate Hyperdrive configuration pointing to its own PlanetScale PostgreSQL database. -| Environment | API URL | Dashboard | User Sites | Trigger | -| -------------- | ------------------------ | ------------------------- | -------------------- | --------------------------------------------- | -| **Production** | `api.void.cloud` | `dash.void.cloud` | `*.void.app` | Manual: "Deploy Platform Production" workflow | -| **Staging** | `api.staging.void.cloud` | `dash.staging.void.cloud` | `*.staging.void.app` | Manual: "Deploy Platform Staging" workflow | +| Environment | API URL | Dashboard | User Sites | Trigger | +| -------------- | ------------------------ | ------------------------- | -------------------- | ----------------------------------------------------------------------------- | +| **Production** | `api.void.cloud` | `dash.void.cloud` | `*.void.app` | Manual: "Deploy Platform Production" workflow | +| **Staging** | `api.staging.void.cloud` | `dash.staging.void.cloud` | `*.staging.void.app` | Automatic: "Deploy Platform Staging" on push to `main` (also manual dispatch) | ## Cloudflare Resources @@ -231,7 +231,7 @@ Two GitHub environments (`Prod` and `Staging`) share the same repo-level secrets | `CF_ACCESS_CLIENT_ID_STAGING` | Staging | CF Access service-token client id for reaching staging (see Staging Access Control) | | `CF_ACCESS_CLIENT_SECRET_STAGING` | Staging | CF Access service-token client secret for reaching staging | -`platform-deploy.yml` uses the `Prod` environment; `platform-deploy-staging.yml` uses `Staging`. Both run only on manual dispatch and only when the repository variable `VOID_PLATFORM_DEPLOY_ENABLED` is `true`. +`platform-deploy.yml` uses the `Prod` environment and runs only on manual dispatch; `platform-deploy-staging.yml` uses `Staging` and also runs on every push to `main` that matches the `platform-ci.yml` path filter. Both run only when the repository variable `VOID_PLATFORM_DEPLOY_ENABLED` is `true`. **GitHub Actions `CF_API_TOKEN` permissions** — narrower-scope token used only for wrangler deploys. Separate from the API worker runtime token. @@ -520,13 +520,15 @@ Four platform workflows live in the repository-level `.github/workflows/` direct 2. `vp run build` (SDK packages the dashboard bundles) 3. `vp run --filter @voidcloud/platform deploy` (api with drizzle-kit migrations, proxy, tail, dispatch, dashboard) -**`platform-deploy-staging.yml`** — manual dispatch (staging, environment: `Staging`): +**`platform-deploy-staging.yml`** — push to `main` that matches the `platform-ci.yml` path filter, or manual dispatch (staging, environment: `Staging`): 1. Runs `platform-ci.yml` first 2. `vp run build` 3. `vp run --filter @voidcloud/platform deploy:staging` (same order, all to staging) -**`platform-smoke-test.yml`** — manual dispatch (environment: `Staging`): builds the SDK, deploys `playground/kitchen-sink` to staging with `void deploy`, resets its state, and runs `platform/scripts/kitchen-sink-smoke-test.ts` against `https://kitchen-sink.staging.void.app`. +A `concurrency` group (`platform-deploy-staging`, `cancel-in-progress: false`) keeps one deploy running and at most one pending, so a burst of pushes never interrupts a deploy between the API migration and the workers. + +**`platform-smoke-test.yml`** — manual dispatch and a daily cron (`0 0 * * *`, 8am SGT), environment: `Staging`: builds the SDK, deploys `playground/kitchen-sink` to staging with `void deploy`, resets its state, and runs `platform/scripts/kitchen-sink-smoke-test.ts` against `https://kitchen-sink.staging.void.app`. ### Health Checks