-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (84 loc) · 2.8 KB
/
deploy-pages.yml
File metadata and controls
96 lines (84 loc) · 2.8 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
name: Deploy LinkSim Pages
on:
push:
branches:
- staging
- main
workflow_dispatch:
inputs:
target:
description: "Deployment target"
required: true
default: "staging"
type: choice
options:
- staging
- prod-main
jobs:
deploy-staging:
if: |
(github.event_name == 'push' && github.ref == 'refs/heads/staging') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'staging')
runs-on: ubuntu-latest
environment: staging
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: staging
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Deploy staging with guardrails
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
VITE_MAPTILER_KEY: ${{ secrets.VITE_MAPTILER_KEY }}
run: npm run deploy:staging
deploy-prod-main:
if: |
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'prod-main')
runs-on: ubuntu-latest
environment: production
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
fetch-tags: true
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Resolve release tag
id: release_tag
run: |
VERSION="$(node -p "require('./package.json').version")"
echo "tag=v${VERSION}" >> "$GITHUB_OUTPUT"
- name: Prepare release worktree
run: git worktree add --detach "$RUNNER_TEMP/linksim-release" "${{ steps.release_tag.outputs.tag }}"
- name: Install dependencies
working-directory: ${{ runner.temp }}/linksim-release
run: npm ci
- name: Validate release gate
working-directory: ${{ runner.temp }}/linksim-release
run: node scripts/validate-prod-release.mjs
- name: Deploy prod/main with guardrails
working-directory: ${{ runner.temp }}/linksim-release
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
VITE_MAPTILER_KEY: ${{ secrets.VITE_MAPTILER_KEY }}
DEPLOY_VERIFY_COMMIT: ${{ github.sha }}
run: npm run build:bundle && npm run build:verify && node "$GITHUB_WORKSPACE/scripts/deploy-pages-safe.mjs" --target prod-main