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]
6+ workflow_dispatch :
7+
8+ # Allow one concurrent deploy; cancel in-progress runs when a new push lands.
9+ concurrency :
10+ group : pages
11+ cancel-in-progress : true
12+
13+ permissions :
14+ contents : read
15+ pages : write
16+ id-token : write
17+
18+ jobs :
19+ build :
20+ runs-on : ubuntu-latest
21+ steps :
22+ - uses : actions/checkout@v4
23+
24+ - uses : actions/setup-node@v4
25+ with :
26+ node-version : 20
27+ cache : npm
28+
29+ - run : npm ci
30+
31+ - name : Build
32+ # Derive Vite's base from the repo name so the site loads correctly at
33+ # https://<user>.github.io/<repo>/ without hardcoding the name anywhere.
34+ run : |
35+ REPO_NAME="${GITHUB_REPOSITORY#*/}"
36+ VITE_BASE="/$REPO_NAME/" npm run build
37+
38+ - uses : actions/upload-pages-artifact@v3
39+ with :
40+ path : dist
41+
42+ deploy :
43+ needs : build
44+ runs-on : ubuntu-latest
45+ environment :
46+ name : github-pages
47+ url : ${{ steps.deployment.outputs.page_url }}
48+ steps :
49+ - id : deployment
50+ uses : actions/deploy-pages@v4
Original file line number Diff line number Diff line change @@ -2,7 +2,11 @@ import { defineConfig } from 'vite'
22import react from '@vitejs/plugin-react'
33
44// https://vite.dev/config/
5+ //
6+ // `base` must match the path the site is served from. On GitHub Pages that's
7+ // `/<repo-name>/`. The Pages deploy workflow sets VITE_BASE to the correct
8+ // value so renames of the repo don't silently break asset URLs.
59export default defineConfig ( ( { command } ) => ( {
610 plugins : [ react ( ) ] ,
7- base : command === 'build' ? '/Teams-TargetedMessages-v3/' : '/' ,
11+ base : command === 'build' ? ( process . env . VITE_BASE || '/teams-shell/' ) : '/' ,
812} ) )
You can’t perform that action at this time.
0 commit comments