-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (65 loc) · 2.41 KB
/
Copy pathdeploy-github-pages.yml
File metadata and controls
76 lines (65 loc) · 2.41 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
# Build static assets and publish to GitHub Pages (Settings → Pages → Source: GitHub Actions).
#
# If the live site shows a blank page, check View Source: if you see src="/src/main.tsx", GitHub Pages
# is still publishing the repo root (branch deploy) instead of this workflow's dist/ — switch Source
# to "GitHub Actions" below and redeploy.
#
# Required repository configuration:
# 1) Settings → Pages → Build and deployment: Source = "GitHub Actions"
# 2) Settings → Secrets and variables → Actions → add secret:
# VITE_TRANSCRIBE_URL = https://<your-api-host>/api/transcribe
# (Your FastAPI server must allow this site's origin; set CORS_EXTRA_ORIGINS on the server,
# e.g. https://<github-username>.github.io )
#
# The workflow sets VITE_BASE_PATH to /${{ github.event.repository.name }}/ so asset URLs match
# https://<user>.github.io/<repo>/.
name: Deploy GitHub Pages
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: github-pages
cancel-in-progress: false
jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install and build
env:
VITE_BASE_PATH: /${{ github.event.repository.name }}/
VITE_TRANSCRIBE_URL: ${{ secrets.VITE_TRANSCRIBE_URL }}
run: |
npm ci
npm run build
# Vite may omit dotfiles from public/; Jekyll ignores are not used for Actions Pages, but this is harmless.
touch dist/.nojekyll
- name: Verify dist is a production bundle (not repo-root index.html)
run: |
if grep -qE 'src="/src/main\.tsx"' dist/index.html; then
echo "::error::dist/index.html still points at Vite dev entry — build output is wrong."
exit 1
fi
if ! grep -qE '/assets/[^"]+\.js' dist/index.html; then
echo "::error::dist/index.html has no hashed /assets/*.js script — not a Vite build."
exit 1
fi
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
with:
path: dist
- id: deploy
name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4