Repository navigation
88 lines (77 loc) · 3.27 KB
/
Copy pathdeploy.yml
File metadata and controls
88 lines (77 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Build & Deploy CampusLoop to Cloudflare Workers
on:
push:
branches:
- main
# Mobile-only pushes build the APK (android-apk.yml); they never change the web app.
paths-ignore:
- "apps/mobile/**"
- ".github/workflows/android-apk.yml"
workflow_dispatch:
concurrency:
group: campusloop-production
cancel-in-progress: true
jobs:
deploy:
name: Build & Deploy to Cloudflare
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout Repository
uses: actions/checkout@v4
# vitest, opennextjs and scripts/deploy.mjs run on Node; match local (v22).
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Setup Bun Environment
uses: oven-sh/setup-bun@v2
with:
# Pinned to the version used locally; bump deliberately, never "latest".
bun-version: 1.4.2
- name: Cache Bun Packages
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
restore-keys: |
bun-${{ runner.os }}-
- name: Install Dependencies
run: bun install --frozen-lockfile
- name: TypeScript Type Check
run: bun run typecheck
- name: Unit Tests
# Tests mock `@/db` (src/test/mock-db.ts) and src/test/setup.ts clears the
# DB URLs, so no database secrets are needed or used here.
run: bun run test
- name: Design System Guard (report)
run: bun run check:design
# Same as `bun run deploy`, plus `populateCache remote` between build and deploy:
# it seeds the R2 incremental cache and creates the D1 `revalidations` tag-cache
# table (CREATE TABLE IF NOT EXISTS), as `opennextjs-cloudflare deploy` would.
- name: Build & Deploy to Cloudflare Workers
run: |
npx opennextjs-cloudflare build
npx opennextjs-cloudflare populateCache remote
node scripts/deploy.mjs deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
DB_URL: ${{ secrets.DB_URL }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
NEXT_PUBLIC_HEXCLAVE_API_URL: ${{ secrets.NEXT_PUBLIC_HEXCLAVE_API_URL }}
NEXT_PUBLIC_HEXCLAVE_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_HEXCLAVE_PROJECT_ID }}
HEXCLAVE_PROJECT_ID: ${{ secrets.HEXCLAVE_PROJECT_ID }}
HEXCLAVE_SECRET_SERVER_KEY: ${{ secrets.HEXCLAVE_SECRET_SERVER_KEY }}
ANON_PEPPER: ${{ secrets.ANON_PEPPER }}
ANON_VAULT_SECRET: ${{ secrets.ANON_VAULT_SECRET }}
IMGBB_API_KEY: ${{ secrets.IMGBB_API_KEY }}
NEXT_PUBLIC_IMGBB_API_KEY: ${{ secrets.NEXT_PUBLIC_IMGBB_API_KEY }}
ADMIN_PASSKEY: ${{ secrets.ADMIN_PASSKEY }}
ADMIN_API_KEY: ${{ secrets.ADMIN_API_KEY }}
UPLOAD_API_KEY: ${{ secrets.UPLOAD_API_KEY }}
ADMIN_SESSION_SECRET: ${{ secrets.ADMIN_SESSION_SECRET }}
INDEXNOW_KEY: ${{ secrets.INDEXNOW_KEY }}
CRON_SECRET: ${{ secrets.CRON_SECRET }}
GIPHY_API_KEY: ${{ secrets.GIPHY_API_KEY }}
NEXT_PUBLIC_GIPHY_API_KEY: ${{ secrets.NEXT_PUBLIC_GIPHY_API_KEY }}