File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Deploy to GitHub Pages
2+
3+ on :
4+ push :
5+ branches : ["main", "master"]
6+ workflow_dispatch :
7+
8+ permissions :
9+ contents : read
10+ pages : write
11+ id-token : write
12+
13+ concurrency :
14+ group : " pages"
15+ cancel-in-progress : false
16+
17+ jobs :
18+ build :
19+ runs-on : ubuntu-latest
20+ steps :
21+ - name : Checkout
22+ uses : actions/checkout@v4
23+
24+ - name : Setup Node.js
25+ uses : actions/setup-node@v4
26+ with :
27+ node-version : ' 18'
28+ cache : ' npm'
29+
30+ - name : Setup Pages
31+ uses : actions/configure-pages@v5
32+
33+ - name : Install dependencies
34+ run : npm ci
35+
36+ - name : Set base path for GitHub Pages
37+ run : |
38+ if [[ '${{ github.event.repository.name }}' == *'.github.io' ]]; then
39+ echo "BASE_PATH=/" >> $GITHUB_ENV
40+ else
41+ echo "BASE_PATH=/${{ github.event.repository.name }}/" >> $GITHUB_ENV
42+ fi
43+
44+ - name : Build for GitHub Pages
45+ run : npm run build:github-pages
46+ env :
47+ GITHUB_PAGES : true
48+
49+ - name : Create 404.html for SPA routing
50+ run : cp dist/public/index.html dist/public/404.html
51+
52+ - name : Upload artifact
53+ uses : actions/upload-pages-artifact@v3
54+ with :
55+ path : ' ./dist/public'
56+
57+ deploy :
58+ environment :
59+ name : github-pages
60+ url : ${{ steps.deployment.outputs.page_url }}
61+ runs-on : ubuntu-latest
62+ needs : build
63+ steps :
64+ - name : Deploy to GitHub Pages
65+ id : deployment
66+ uses : actions/deploy-pages@v4
You can’t perform that action at this time.
0 commit comments