ci(web): add web-ci and web-deploy GitHub Actions workflows
web-ci.yml — runs on push/PR to master|dev that touches web/**: - format:check (prettier --check) - lint (eslint flat config) - type-check (tsc --noEmit) - bun run build (next build, sanity) - bunx opennextjs-cloudflare build (Cloudflare worker bundle) web-deploy.yml — runs on push to master that touches web/** OR manual workflow_dispatch (with optional environment input): - bun install --frozen-lockfile - bun run prebuild + bunx opennextjs-cloudflare build - cloudflare/wrangler-action@v3 deploy with CLOUDFLARE_API_TOKEN + CLOUDFLARE_ACCOUNT_ID secrets, scoped to working-directory: web Both gated by paths-filter so plugin-only changes do not trigger them. Concurrency group cancels in-progress CI runs but NOT in-progress deploys. A web-production GitHub environment is referenced so deploys can be gated behind required reviewers / wait timers if desired. Verified locally end-to-end before push: - bun install: 678 packages - format:check: pass after `bun run format` reformatted 21 files - lint: pass - type-check: pass - bun run build: pass (4 locales × pages built) - bunx opennextjs-cloudflare build: pass (.open-next/worker.js generated)
This commit is contained in:
@@ -0,0 +1,52 @@
|
|||||||
|
name: Web CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master, dev]
|
||||||
|
paths:
|
||||||
|
- "web/**"
|
||||||
|
- ".github/workflows/web-ci.yml"
|
||||||
|
pull_request:
|
||||||
|
branches: [master, dev]
|
||||||
|
paths:
|
||||||
|
- "web/**"
|
||||||
|
- ".github/workflows/web-ci.yml"
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
format-lint-typecheck-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: web
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: oven-sh/setup-bun@v2
|
||||||
|
with:
|
||||||
|
bun-version: "1.3.12"
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: bun install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Format check
|
||||||
|
run: bun run format:check
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
run: bun run lint
|
||||||
|
|
||||||
|
- name: Type check
|
||||||
|
run: bun run type-check
|
||||||
|
|
||||||
|
- name: Next build
|
||||||
|
run: bun run build
|
||||||
|
env:
|
||||||
|
NEXT_TELEMETRY_DISABLED: "1"
|
||||||
|
|
||||||
|
- name: OpenNext (Cloudflare) build
|
||||||
|
run: bunx opennextjs-cloudflare build
|
||||||
|
env:
|
||||||
|
NEXT_TELEMETRY_DISABLED: "1"
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
name: Web Deploy (Cloudflare Workers)
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
environment:
|
||||||
|
description: "Wrangler environment (leave blank for default)"
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
paths:
|
||||||
|
- "web/**"
|
||||||
|
- ".github/workflows/web-deploy.yml"
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: web-deploy-${{ github.ref }}
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment:
|
||||||
|
name: web-production
|
||||||
|
url: https://ohmyopenagent.com
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: web
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
deployments: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: oven-sh/setup-bun@v2
|
||||||
|
with:
|
||||||
|
bun-version: "1.3.12"
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: bun install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Build with OpenNext for Cloudflare
|
||||||
|
run: |
|
||||||
|
bun run prebuild
|
||||||
|
bunx opennextjs-cloudflare build
|
||||||
|
env:
|
||||||
|
NEXT_TELEMETRY_DISABLED: "1"
|
||||||
|
|
||||||
|
- name: Deploy to Cloudflare Workers
|
||||||
|
uses: cloudflare/wrangler-action@v3
|
||||||
|
with:
|
||||||
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||||
|
workingDirectory: web
|
||||||
|
command: ${{ inputs.environment && format('deploy --env {0}', inputs.environment) || 'deploy' }}
|
||||||
Reference in New Issue
Block a user