Skip to content

Merge pull request #50 from manaflow-ai/feat-cloudflare-do #2

Merge pull request #50 from manaflow-ai/feat-cloudflare-do

Merge pull request #50 from manaflow-ai/feat-cloudflare-do #2

Workflow file for this run

name: Cloudflare Durable Object
on:
pull_request:
paths:
- ".github/workflows/cloudflare-do.yml"
- "cloudflare/**"
push:
branches:
- main
paths:
- ".github/workflows/cloudflare-do.yml"
- "cloudflare/**"
workflow_dispatch:
inputs:
deploy_environment:
description: "Cloudflare environment to deploy"
required: true
default: "staging"
type: choice
options:
- staging
- production
permissions:
contents: read
concurrency:
group: cloudflare-do-${{ github.event_name == 'workflow_dispatch' && inputs.deploy_environment || github.ref }}
cancel-in-progress: false
jobs:
verify:
name: Verify
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14
- name: Install
working-directory: cloudflare
run: bun install --frozen-lockfile
- name: Typecheck
working-directory: cloudflare
run: bun run typecheck
- name: Test
working-directory: cloudflare
run: bun run test
- name: Validate Worker bundle
working-directory: cloudflare/packages/worker
run: bunx wrangler deploy --env staging --dry-run --outdir dist-dry-run
deploy-staging:
name: Deploy staging
needs: verify
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' && inputs.deploy_environment == 'staging'
environment:
name: subrouter-staging
url: https://subrouter-staging.cmux.dev/healthz
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14
- name: Install
working-directory: cloudflare
run: bun install --frozen-lockfile
- name: Deploy
working-directory: cloudflare/packages/worker
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: bunx wrangler deploy --env staging --keep-vars
- name: Smoke health
run: curl -fsS https://subrouter-staging.cmux.dev/healthz
deploy-production:
name: Deploy production
needs: verify
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && inputs.deploy_environment == 'production'
environment:
name: subrouter-production
url: https://subrouter.cmux.dev/healthz
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14
- name: Install
working-directory: cloudflare
run: bun install --frozen-lockfile
- name: Deploy
working-directory: cloudflare/packages/worker
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: bunx wrangler deploy --env production --keep-vars
- name: Smoke health
run: curl -fsS https://subrouter.cmux.dev/healthz