-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (81 loc) · 2.72 KB
/
Copy pathdeploy-admin.yml
File metadata and controls
94 lines (81 loc) · 2.72 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
89
90
91
92
93
94
name: Deploy Keystatic admin Worker
on:
push:
branches: ["main"]
paths:
- "apps/admin/**"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- ".github/workflows/deploy-admin.yml"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: admin-worker-production
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out trusted admin code
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Set up pnpm
uses: pnpm/action-setup@v6
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: "22"
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Type-check admin application
run: pnpm --filter @preferredai/admin typecheck
- name: Build admin Worker without deployment secrets
env:
KEYSTATIC_GITHUB_CLIENT_ID: build-placeholder
KEYSTATIC_GITHUB_CLIENT_SECRET: build-placeholder
KEYSTATIC_SECRET: 0000000000000000000000000000000000000000000000000000000000000000
NEXT_PUBLIC_KEYSTATIC_STORAGE_KIND: github
NEXT_PUBLIC_KEYSTATIC_GITHUB_APP_SLUG: preferredai-keystatic
run: pnpm --filter @preferredai/admin build:worker
- name: Upload Worker bundle
uses: actions/upload-artifact@v7
with:
name: admin-worker
path: |
apps/admin/.open-next
apps/admin/wrangler.jsonc
include-hidden-files: true
if-no-files-found: error
retention-days: 3
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: admin-production
url: https://admin.preferred.ai/keystatic
steps:
- name: Download Worker bundle
uses: actions/download-artifact@v8
with:
name: admin-worker
path: admin-worker
- name: Deploy editor-only Worker
uses: cloudflare/wrangler-action@v4
with:
apiToken: ${{ secrets.CLOUDFLARE_WORKERS_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
workingDirectory: admin-worker
packageManager: npm
wranglerVersion: 4.124.0
command: deploy --config wrangler.jsonc --keep-vars
- name: Smoke-test admin origin
shell: bash
run: |
set -euo pipefail
curl --fail --silent --show-error --location --retry 10 --retry-all-errors https://admin.preferred.ai/keystatic > /dev/null
status="$(curl --silent --output /dev/null --write-out '%{http_code}' https://admin.preferred.ai/)"
test "$status" = "307" -o "$status" = "308"