Repository navigation
76 lines (69 loc) · 2.38 KB
/
Copy pathdeploy.yml
File metadata and controls
76 lines (69 loc) · 2.38 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
name: 🚀 Deploy
on:
push:
branches: [main]
paths-ignore:
- '.github/README.md'
schedule:
- cron: '23 5 * * 1'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: deploy
cancel-in-progress: true
jobs:
deploy:
name: 🚀 Build and deploy
if: github.repository_owner == 'NotAFlightRisk'
runs-on: ubuntu-latest
environment:
name: production
url: https://fineprint.peng.ly
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
package-manager-cache: false
- run: npm ci
- run: npm test
- run: npm run build
env:
PUBLIC_PLAUSIBLE_SCRIPT: ${{ vars.PUBLIC_PLAUSIBLE_SCRIPT }}
PUBLIC_SENTRY_DSN: ${{ vars.PUBLIC_SENTRY_DSN }}
SENTRY_URL: ${{ vars.SENTRY_URL }}
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Describe the Worker
run: |
cat > "$RUNNER_TEMP/wrangler.json" <<JSON
{
"name": "fineprint",
"compatibility_date": "2026-10-01",
"assets": { "directory": "$PWD/build", "not_found_handling": "404-page" },
"routes": [{ "pattern": "fineprint.peng.ly", "custom_domain": true }]
}
JSON
- name: Push it to Cloudflare
uses: cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4.1.3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: deploy --config ${{ runner.temp }}/wrangler.json
- name: Check the site picked it up
run: |
site=$(node -p "require('./package.json').homepage")
want=$(cat build/_app/version.json)
for i in $(seq 1 10); do
if [ "$(curl -fsS "$site/_app/version.json?$i")" = "$want" ]; then
echo "✅ [$site]($site) is serving \`$want\`" >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
sleep 6
done
echo "❌ [$site]($site) is still on an older build" >> "$GITHUB_STEP_SUMMARY"
exit 1