Skip to content

Commit 5da3f66

Browse files
authored
Merge pull request #31 from Western-Formula-Racing/dev-main
Add GitHub Pages deploy workflow and Vite base config
2 parents 1677f5c + 019eb6c commit 5da3f66

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

.github/workflows/deploy-pecan.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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

pecan/vite.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import react from "@vitejs/plugin-react";
33
import tailwindcss from "@tailwindcss/vite";
44
import 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
711
const websocketPlugin = (): Plugin => ({
812
name: 'websocket-server',
@@ -71,6 +75,7 @@ function startWebSocketServer() {
7175

7276
// https://vite.dev/config/
7377
export default defineConfig({
78+
base: isGitHubPages ? `/${repoName}/` : '/',
7479
plugins: [
7580
react(),
7681
tailwindcss(),

0 commit comments

Comments
 (0)