Skip to content

Deploy to GitHub Pages #31

Deploy to GitHub Pages

Deploy to GitHub Pages #31

Workflow file for this run

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