Repository navigation
109 lines (102 loc) · 4.29 KB
/
Copy pathstack127-ci.yml
File metadata and controls
109 lines (102 loc) · 4.29 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
name: Stack127 CI
on:
pull_request:
paths-ignore:
- "**/*.md"
- "content_docs/**"
- "skills/**"
- "stack127_docs/**"
- "stack127_records/**"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: stack127-ci-${{ github.ref }}
cancel-in-progress: true
jobs:
verify:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- run: npm ci
- run: npm run test:core
- name: Check page publishing and recovery
run: npm run test:focused -- tests/stack127/page-publishing.test.mjs tests/stack127/page-publishing-database.test.mjs tests/stack127/frontend-content-queue.test.mjs tests/stack127/frontend-static.test.mjs tests/stack127/cache-process-hosting.test.mjs
verify-production-build:
needs: verify
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
environment: production
timeout-minutes: 35
# CI and production uploads use the same isolated preview service.
concurrency:
group: stack127-production
cancel-in-progress: false
queue: max
env:
STACK127_RELEASE_SHA: ${{ github.sha }}
STACK127_BUILD_SHA: ${{ github.sha }}
STACK127_FRONTEND_HOSTING: ${{ vars.STACK127_FRONTEND_HOSTING || 'legacy' }}
DATABASE_URL: ${{ secrets.DATABASE_POOLER_URL || secrets.DATABASE_URL }}
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_PUBLISHABLE_KEY: ${{ secrets.SUPABASE_PUBLISHABLE_KEY }}
SUPABASE_SECRET_KEY: ${{ secrets.SUPABASE_SECRET_KEY }}
GOOGLE_ANALYTICS_ID: ${{ vars.GOOGLE_ANALYTICS_ID || 'G-ZJNG8SCGE1' }}
UMAMI_URL: ${{ vars.UMAMI_URL || 'https://umami.ravitejaknts.com' }}
UMAMI_WEBSITE_ID: ${{ vars.UMAMI_WEBSITE_ID || 'ff47ea40-04e6-4a74-b4cc-e420d28433d3' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- run: npm ci
- run: npm run build
- name: Save checked build manifests
uses: actions/upload-artifact@v4
with:
name: stack127-build-manifests-${{ github.sha }}
path: |
.next/app-path-routes-manifest.json
.next/prerender-manifest.json
include-hidden-files: true
if-no-files-found: error
retention-days: 1
- name: Check the static frontend export before merge
run: node scripts/stack127/frontend/build.mjs --output "$RUNNER_TEMP/frontend-assets"
- name: Save the checked frontend for review
uses: actions/upload-artifact@v4
with:
name: stack127-frontend-assets-${{ github.sha }}
path: ${{ runner.temp }}/frontend-assets
if-no-files-found: error
retention-days: 1
- name: Check whether an isolated preview can be deployed
id: preview
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID || secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_ZONE_ID: ${{ vars.CLOUDFLARE_ZONE_ID || secrets.CLOUDFLARE_ZONE_ID }}
shell: bash
run: |
if [ -n "$CLOUDFLARE_API_TOKEN" ] && [ -n "$CLOUDFLARE_ACCOUNT_ID" ] && [ -n "$CLOUDFLARE_ZONE_ID" ]; then
echo 'available=true' >> "$GITHUB_OUTPUT"
fi
- name: Verify the isolated frontend preview
if: steps.preview.outputs.available == 'true'
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID || secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_ZONE_ID: ${{ vars.CLOUDFLARE_ZONE_ID || secrets.CLOUDFLARE_ZONE_ID }}
run: |
node --input-type=module <<'NODE'
import { appendFile } from 'node:fs/promises';
import { deployFrontend } from './scripts/stack127/frontend/deploy.mjs';
const preview = await deployFrontend({ directory: `${process.env.RUNNER_TEMP}/frontend-assets`, preview: true });
await appendFile(process.env.GITHUB_STEP_SUMMARY, `Frontend preview: ${preview.site}\n\nCommit: ${preview.sha}\n`);
NODE