Repository navigation
89 lines (78 loc) · 2.44 KB
/
Copy pathdocs-deploy.yml
File metadata and controls
89 lines (78 loc) · 2.44 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
name: Deploy docs site
on:
push:
branches:
- main
paths:
- 'docs/**'
- 'package.json'
- 'package-lock.json'
- '.node-version'
- '.github/workflows/docs-deploy.yml'
- 'scripts/generate-update-manifest.ts'
- 'src/modules/updates/manifest.ts'
- 'src/modules/updates/version.ts'
workflow_dispatch:
workflow_call:
inputs:
expected_version:
description: npm version that must be visible before deployment.
required: false
default: ''
type: string
expected_channel:
description: npm dist-tag that must point at the expected version.
required: false
default: ''
type: string
permissions:
contents: read
concurrency:
group: docs-production
cancel-in-progress: false
jobs:
deploy:
name: Build and deploy neondeck.dev
runs-on: ubuntu-latest
environment: docs-production
steps:
- name: Check out repository
uses: actions/checkout@v7
with:
ref: main
- name: Set up Node
uses: actions/setup-node@v7
with:
node-version-file: .node-version
cache: npm
- name: Install dependencies
run: npm ci
- name: Generate release manifest
run: npm run docs:release-manifest
env:
NEONDECK_EXPECTED_RELEASE_VERSION: ${{ inputs.expected_version }}
NEONDECK_EXPECTED_RELEASE_CHANNEL: ${{ inputs.expected_channel }}
- name: Build Astro site
run: npm run docs:build
- name: Deploy to Cloudflare
working-directory: docs
run: npx wrangler deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- name: Verify deployed release manifest
run: |
set -euo pipefail
for attempt in $(seq 1 12); do
if curl --fail --silent --show-error \
--header 'Cache-Control: no-cache' \
"https://neondeck.dev/latest.json?deployment=${GITHUB_SHA}-${GITHUB_RUN_ATTEMPT}-${attempt}" \
| cmp --silent - docs/public/latest.json; then
exit 0
fi
if [ "${attempt}" -eq 12 ]; then
echo "The deployed release manifest did not match the generated manifest." >&2
exit 1
fi
echo "Cloudflare deployment propagation is pending (attempt ${attempt}/12); retrying in 5 seconds."
sleep 5
done