Repository navigation
195 lines (172 loc) · 6.71 KB
/
Copy pathdeploy-docs.yml
File metadata and controls
195 lines (172 loc) · 6.71 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
183
184
185
186
187
188
189
190
191
192
193
194
195
name: Deploy Docs
on:
workflow_dispatch:
push:
branches:
- master
- main
tags:
- "v*"
paths:
- ".github/workflows/deploy-docs.yml"
- "apps/site/**"
- "packaging/repositories/apt-channel.json"
- "apps/docs/**"
- "assets/product-screenshot.png"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- "tsconfig.base.json"
- ".npmrc"
- "scripts/install.sh"
- "scripts/build-static-site.mjs"
- "scripts/verify-static-site.mjs"
- "scripts/verify-docs.sh"
- "scripts/verify-support-matrix.mjs"
- "scripts/verify-vm-evidence.sh"
- "vm/targets.tsv"
- "scripts/deploy-docs-bunny.sh"
- "scripts/verify-docs-deployment-manifest.mjs"
- "scripts/verify-docs-live.sh"
permissions:
contents: read
concurrency:
group: deploy-docs
cancel-in-progress: true
jobs:
build-docs:
name: Build static site artifact
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v7.0.0
- name: Set up pnpm
uses: pnpm/action-setup@v6.0.9
with:
version: 11.3.0
- name: Set up Node
uses: actions/setup-node@v6.4.0
with:
node-version: 22.23.1
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Verify docs contract
run: pnpm verify:docs
- name: Build web artifact
run: pnpm build:web
- name: Verify static site artifact
run: pnpm verify:site
- name: Upload docs artifact
uses: actions/upload-artifact@v7.0.1
with:
name: loopwire-docs
path: dist/site
deploy-bunny:
name: Deploy to Bunny.net
needs: build-docs
runs-on: ubuntu-latest
timeout-minutes: 20
environment: docs-production
if: >-
${{
github.event_name == 'workflow_dispatch' ||
github.ref == 'refs/heads/main' ||
github.ref == 'refs/heads/master' ||
startsWith(github.ref, 'refs/tags/v')
}}
steps:
- name: Checkout
uses: actions/checkout@v7.0.0
- name: Set up pnpm
uses: pnpm/action-setup@v6.0.9
with:
version: 11.3.0
- name: Set up Node
uses: actions/setup-node@v6.4.0
with:
node-version: 22.23.1
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Download docs artifact
uses: actions/download-artifact@v8.0.1
with:
name: loopwire-docs
path: dist/site
- name: Verify downloaded static site artifact
run: pnpm verify:site
- name: Require Bunny.net configuration
id: bunny
env:
BUNNY_STORAGE_ZONE: ${{ vars.BUNNY_STORAGE_ZONE || secrets.BUNNY_STORAGE_ZONE }}
BUNNY_ACCESS_KEY: ${{ secrets.BUNNY_ACCESS_KEY }}
BUNNY_API_KEY: ${{ secrets.BUNNY_API_KEY }}
BUNNY_PULL_ZONE_ID: ${{ vars.BUNNY_PULL_ZONE_ID || secrets.BUNNY_PULL_ZONE_ID }}
BUNNY_STORAGE_ENDPOINT: ${{ vars.BUNNY_STORAGE_ENDPOINT || secrets.BUNNY_STORAGE_ENDPOINT }}
BUNNY_REMOTE_PREFIX: ${{ vars.BUNNY_REMOTE_PREFIX || secrets.BUNNY_REMOTE_PREFIX }}
BUNNY_PULL_ZONE_HOSTNAME: ${{ vars.BUNNY_PULL_ZONE_HOSTNAME || secrets.BUNNY_PULL_ZONE_HOSTNAME }}
run: |
set -euo pipefail
missing=()
[ -n "${BUNNY_STORAGE_ZONE:-}" ] || missing+=(BUNNY_STORAGE_ZONE)
[ -n "${BUNNY_ACCESS_KEY:-}" ] || missing+=(BUNNY_ACCESS_KEY)
[ -n "${BUNNY_API_KEY:-}" ] || missing+=(BUNNY_API_KEY)
[ -n "${BUNNY_PULL_ZONE_ID:-}" ] || missing+=(BUNNY_PULL_ZONE_ID)
if [ "${#missing[@]}" -gt 0 ]; then
echo "::error::Bunny.net deployment configuration is missing: ${missing[*]}"
echo "::error::Run the guarded cross-platform setup: pnpm setup:github -- --repo ${GITHUB_REPOSITORY} --scope deploy"
echo "::error::The prompts explain where every Bunny value is found and keep credentials hidden."
exit 1
fi
if [ -n "${BUNNY_PULL_ZONE_HOSTNAME:-}" ]; then
echo "hostname=true" >>"$GITHUB_OUTPUT"
else
echo "hostname=false" >>"$GITHUB_OUTPUT"
fi
- name: Upload files and purge Bunny.net CDN cache
env:
BUNNY_STORAGE_ZONE: ${{ vars.BUNNY_STORAGE_ZONE || secrets.BUNNY_STORAGE_ZONE }}
BUNNY_ACCESS_KEY: ${{ secrets.BUNNY_ACCESS_KEY }}
BUNNY_API_KEY: ${{ secrets.BUNNY_API_KEY }}
BUNNY_PULL_ZONE_ID: ${{ vars.BUNNY_PULL_ZONE_ID || secrets.BUNNY_PULL_ZONE_ID }}
BUNNY_STORAGE_ENDPOINT: ${{ vars.BUNNY_STORAGE_ENDPOINT || secrets.BUNNY_STORAGE_ENDPOINT }}
BUNNY_REMOTE_PREFIX: ${{ vars.BUNNY_REMOTE_PREFIX || secrets.BUNNY_REMOTE_PREFIX }}
LOOPWIRE_DOCS_DEPLOYMENT_MANIFEST: dist/docs-deployment/deployment-manifest.json
run: bash scripts/deploy-docs-bunny.sh --dist dist/site --purge-cache
- name: Verify docs deployment manifest
env:
BUNNY_STORAGE_ZONE: ${{ vars.BUNNY_STORAGE_ZONE || secrets.BUNNY_STORAGE_ZONE }}
BUNNY_STORAGE_ENDPOINT: ${{ vars.BUNNY_STORAGE_ENDPOINT || secrets.BUNNY_STORAGE_ENDPOINT }}
BUNNY_REMOTE_PREFIX: ${{ vars.BUNNY_REMOTE_PREFIX || secrets.BUNNY_REMOTE_PREFIX }}
run: |
pnpm verify:docs-deployment -- \
--manifest dist/docs-deployment/deployment-manifest.json \
--dist dist/site \
--storage-zone "$BUNNY_STORAGE_ZONE" \
--storage-endpoint "${BUNNY_STORAGE_ENDPOINT:-https://storage.bunnycdn.com}" \
--remote-prefix "$BUNNY_REMOTE_PREFIX" \
--git-head "$GITHUB_SHA" \
--expected-dry-run false
- name: Upload docs deployment manifest
uses: actions/upload-artifact@v7.0.1
with:
name: loopwire-docs-deployment
path: dist/docs-deployment/deployment-manifest.json
- name: Report pull-zone hostname
if: ${{ steps.bunny.outputs.hostname == 'true' }}
env:
BUNNY_PULL_ZONE_HOSTNAME: ${{ vars.BUNNY_PULL_ZONE_HOSTNAME || secrets.BUNNY_PULL_ZONE_HOSTNAME }}
BUNNY_REMOTE_PREFIX: ${{ vars.BUNNY_REMOTE_PREFIX || secrets.BUNNY_REMOTE_PREFIX }}
run: |
bash scripts/verify-docs-live.sh \
--hostname "$BUNNY_PULL_ZONE_HOSTNAME" \
--remote-prefix "$BUNNY_REMOTE_PREFIX"
docs_url="https://${BUNNY_PULL_ZONE_HOSTNAME}"
prefix="${BUNNY_REMOTE_PREFIX#/}"
prefix="${prefix%/}"
if [ -n "$prefix" ]; then
docs_url="${docs_url}/${prefix}"
fi
echo "Docs deployed to ${docs_url}"