Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/deploy-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build & Publish Frontend to GitHub Pages

on:
push:
branches: [ "main" ]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: "18"

- name: Install & build frontend
working-directory: frontend
env:
VITE_API_BASE: ${{ secrets.FRONTEND_API_BASE }}
VITE_SOCKET_URL: ${{ secrets.FRONTEND_SOCKET_URL }}
run: |
npm ci
# ensure build-time env vars exist for Vite (safe defaults if secrets missing)
cat > .env.production <<EOV
VITE_API_BASE=${{ secrets.FRONTEND_API_BASE }}
VITE_SOCKET_URL=${{ secrets.FRONTEND_SOCKET_URL }}
EOV
npm run build

- name: Upload build artifact for GitHub Pages
uses: actions/upload-pages-artifact@v1
with:
path: frontend/dist

- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v1
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# local env and build artifacts
.env.production
frontend/dist/
frontend/node_modules/
Loading