Repository navigation
68 lines (59 loc) · 2.18 KB
/
Copy pathdeploy.yml
File metadata and controls
68 lines (59 loc) · 2.18 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
name: Deploy to GitHub Pages
on:
workflow_run:
workflows: ['CI Tests']
types: [completed]
branches: [main]
workflow_dispatch:
# Allow only one concurrent deployment
concurrency:
group: pages
cancel-in-progress: true
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
if: github.event_name == 'workflow_dispatch' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}
- name: Setup Pages
uses: actions/configure-pages@v5
# ── Inject environment variables ──────────────────────────────
- name: Inject GA_MEASUREMENT_ID and TURNSTILE_SITE_KEY
env:
GA_ID: ${{ secrets.GA_MEASUREMENT_ID }}
TURNSTILE_SITE_KEY: ${{ secrets['TURNSTILE_SITE_KEY'] }}
run: |
if [ -n "$GA_ID" ]; then
sed -i "s|__GA_MEASUREMENT_ID__|${GA_ID}|g" index.html
echo "✅ GA measurement ID injected"
else
echo "⚠️ GA_MEASUREMENT_ID secret not set — analytics disabled in this build"
fi
if [ -n "$TURNSTILE_SITE_KEY" ]; then
sed -i "s|__TURNSTILE_SITE_KEY__|${TURNSTILE_SITE_KEY}|g" index.html
echo "✅ Turnstile site key injected"
else
echo "⚠️ TURNSTILE_SITE_KEY secret not set — contact form verification disabled in this build"
fi
# ── Upload artifact ───────────────────────────────────────────
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: .
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4