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 Pecan to GitHub Pages
2+
3+ on :
4+ push :
5+ branches : [ "main" ]
6+ paths :
7+ - ' pecan/**'
8+ - ' .github/workflows/deploy-pecan.yml'
9+ workflow_dispatch :
10+
11+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
12+ permissions :
13+ contents : read
14+ pages : write
15+ id-token : write
16+
17+ # Allow only one concurrent deployment
18+ concurrency :
19+ group : " pages"
20+ cancel-in-progress : false
21+
22+ jobs :
23+ build :
24+ runs-on : ubuntu-latest
25+
26+ steps :
27+ - name : Checkout
28+ uses : actions/checkout@v4
29+
30+ - name : Setup Node.js
31+ uses : actions/setup-node@v4
32+ with :
33+ node-version : ' 20'
34+ cache : ' npm'
35+ cache-dependency-path : pecan/package-lock.json
36+
37+ - name : Install dependencies
38+ working-directory : ./pecan
39+ run : npm ci
40+
41+ - name : Build
42+ working-directory : ./pecan
43+ run : npm run build
44+
45+ - name : Upload artifact
46+ uses : actions/upload-pages-artifact@v3
47+ with :
48+ path : ./pecan/dist
49+
50+ deploy :
51+ environment :
52+ name : github-pages
53+ url : ${{ steps.deployment.outputs.page_url }}
54+ runs-on : ubuntu-latest
55+ needs : build
56+
57+ steps :
58+ - name : Deploy to GitHub Pages
59+ id : deployment
60+ uses : actions/deploy-pages@v4
Original file line number Diff line number Diff line change @@ -3,6 +3,10 @@ import react from "@vitejs/plugin-react";
33import tailwindcss from "@tailwindcss/vite" ;
44import type { Plugin } from "vite" ;
55
6+ // GitHub Pages deployment - repository name (change if different)
7+ const isGitHubPages = process . env . GITHUB_ACTIONS === 'true' ;
8+ const repoName = 'daq-radio' ;
9+
610// WebSocket server plugin - runs in both development and production
711const websocketPlugin = ( ) : Plugin => ( {
812 name : 'websocket-server' ,
@@ -71,6 +75,7 @@ function startWebSocketServer() {
7175
7276// https://vite.dev/config/
7377export default defineConfig ( {
78+ base : isGitHubPages ? `/${ repoName } /` : '/' ,
7479 plugins : [
7580 react ( ) ,
7681 tailwindcss ( ) ,
You can’t perform that action at this time.
0 commit comments