diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000000..1f2f4ced582 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,38 @@ +name: deploy + +on: + push: + branches: + - v1 + workflow_dispatch: + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +permissions: + contents: read + +jobs: + deploy: + if: github.repository == 'anomalyco/opencode' && github.ref_name == 'v1' + runs-on: blacksmith-4vcpu-ubuntu-2404 + environment: v1 + steps: + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + + - uses: ./.github/actions/setup-bun + + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: "24" + + # Only the V1 web app (app.opencode.ai) deploys from v1. + - run: bun sst deploy --stage=v1 + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_ORG: ${{ vars.SENTRY_ORG }} + SENTRY_PROJECT: ${{ vars.WEB_SENTRY_PROJECT }} + SENTRY_RELEASE: web@${{ github.sha }} + VITE_SENTRY_DSN: ${{ vars.WEB_SENTRY_DSN }} + VITE_SENTRY_ENVIRONMENT: production + VITE_SENTRY_RELEASE: web@${{ github.sha }} diff --git a/sst.config.ts b/sst.config.ts index 41321005bf4..2dae155b10c 100644 --- a/sst.config.ts +++ b/sst.config.ts @@ -7,27 +7,43 @@ export default $config({ removal: input?.stage === "production" ? "retain" : "remove", protect: ["production"].includes(input?.stage), home: "cloudflare", - providers: { - aws: { - version: "7.30.0", - region: "us-east-1", - profile: process.env.GITHUB_ACTIONS - ? undefined - : input.stage === "production" - ? "opencode-production" - : "opencode-dev", - }, - stripe: { - version: "0.0.28", - apiKey: process.env.STRIPE_SECRET_KEY!, - }, - random: "4.19.2", - planetscale: "0.4.1", - honeycomb: "0.49.0", - }, + providers: + input.stage === "v1" + ? {} + : { + aws: { + version: "7.30.0", + region: "us-east-1", + profile: process.env.GITHUB_ACTIONS + ? undefined + : input.stage === "production" + ? "opencode-production" + : "opencode-dev", + }, + stripe: { + version: "0.0.28", + apiKey: process.env.STRIPE_SECRET_KEY!, + }, + random: "4.19.2", + planetscale: "0.4.1", + honeycomb: "0.49.0", + }, } }, async run() { + // The v1 branch only serves the V1 web app; everything else deploys from dev and production. + if ($app.stage === "v1") { + const app = new sst.cloudflare.StaticSite("WebApp", { + domain: "app.opencode.ai", + path: "packages/app", + build: { + command: "bun turbo build", + output: "./dist", + }, + }) + return { WebAppUrl: app.url } + } + const stage = await import("./infra/stage.js") await import("./infra/app.js") const stats = stage.deployAws ? await import("./infra/stats.js") : undefined