-
Notifications
You must be signed in to change notification settings - Fork 0
182 lines (153 loc) · 6.86 KB
/
Copy pathdeploy.yml
File metadata and controls
182 lines (153 loc) · 6.86 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
name: Build & deploy the Null sites
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
schedule:
- cron: '0 6 * * 1' # weekly: re-hash every pinned release asset against the trust manifest
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || 'pages' }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@f40ffcd9367d9f12939873eb1018b921a783ffaa # v4
with:
version: 10.25.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Static and content checks
run: pnpm check && pnpm check:content && pnpm check:infra && pnpm test:unit && pnpm test:release
- name: Verify pinned release assets
if: github.event_name == 'schedule'
run: pnpm test:release:network
- name: Install browser for UI quality gates
if: github.event_name != 'schedule'
run: pnpm exec playwright install --with-deps chromium webkit
- name: Build all sites
if: github.event_name != 'schedule'
run: pnpm build:all
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build legacy HTTP redirect bundles
if: github.event_name != 'schedule'
run: pnpm build:redirects
- name: Validate production artifacts
if: github.event_name != 'schedule'
run: pnpm check:build
- name: Run responsive and accessibility contracts
if: github.event_name != 'schedule'
run: pnpm exec playwright test
- name: Upload browser diagnostics
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: playwright-diagnostics
path: |
test-results/
playwright-report/
if-no-files-found: ignore
retention-days: 7
# apex — nullmenu.ai, served by this repo's GitHub Pages
- uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
with:
path: build/menu
- name: Upload product builds
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: product-sites
path: build/
retention-days: 1
- name: Upload legacy redirect bundles
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: legacy-redirects
path: build/redirects/
retention-days: 1
# The protected Pages environment gates the whole release before any product
# ref moves. Products are staged and promoted first; apex is published last;
# one finalizer restores the products on handoff, apex or cancellation failure.
deploy-release:
needs: build
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: product-sites
path: build
- name: Deploy product sites as one release
run: node scripts/deploy-subdomains.js --manifest build/deployment/subdomains.json
env:
NULLMENU_DEPLOY_TOKEN: ${{ secrets.NULLMENU_DEPLOY_TOKEN }}
- name: Upload deployment rollback state
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: deployment-state
path: build/deployment/subdomains.json
retention-days: 7
- id: deployment
name: Deploy apex last
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
- name: Roll back product refs if apex deployment fails
if: (failure() || cancelled()) && hashFiles('build/deployment/subdomains.json') != ''
env:
NULLMENU_DEPLOY_TOKEN: ${{ secrets.NULLMENU_DEPLOY_TOKEN }}
run: node scripts/rollback-subdomains.js build/deployment/subdomains.json
# `_worker.js` returns real 308 responses on Cloudflare Pages. These two
# optional deploys activate when the account secrets and Pages projects are
# configured; GitHub Pages itself cannot emit redirect status codes.
deploy-legacy-redirects:
needs: build
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: legacy-redirects
path: build/redirects
- name: Deploy nullclaw.io redirects
if: env.CLOUDFLARE_API_TOKEN != '' && env.CLOUDFLARE_ACCOUNT_ID != ''
uses: cloudflare/wrangler-action@ebbaa1584979971c8614a24965b4405ff95890e0 # v4.0.0
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy build/redirects/nullclaw.io --project-name=nullclaw-io-redirect --branch=main
- name: Deploy nullhub.io redirects
if: env.CLOUDFLARE_API_TOKEN != '' && env.CLOUDFLARE_ACCOUNT_ID != ''
uses: cloudflare/wrangler-action@ebbaa1584979971c8614a24965b4405ff95890e0 # v4.0.0
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy build/redirects/nullhub.io --project-name=nullhub-io-redirect --branch=main
- name: Explain inactive legacy deployment
if: env.CLOUDFLARE_API_TOKEN == '' || env.CLOUDFLARE_ACCOUNT_ID == ''
run: echo 'Legacy redirect bundles are valid but require Cloudflare Pages credentials and domain binding.'