Skip to content

Commit 95dc7c0

Browse files
committed
add gha
1 parent 6b30a37 commit 95dc7c0

2 files changed

Lines changed: 64 additions & 1 deletion

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Deploy Playground to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: ["main"] # Change to your default branch if different
6+
workflow_dispatch: # Allows manual trigger
7+
8+
# Sets permissions for GitHub Pages
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# Allow only one concurrent deployment
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '22'
30+
cache: 'npm'
31+
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- name: Build @styx/core
36+
run: npm run build -w @styx/core
37+
38+
- name: Build playground
39+
run: npm run build -w playground
40+
env:
41+
NODE_ENV: production
42+
43+
- name: Setup Pages
44+
uses: actions/configure-pages@v4
45+
46+
- name: Upload artifact
47+
uses: actions/upload-pages-artifact@v3
48+
with:
49+
path: './playground/dist'
50+
51+
deploy:
52+
environment:
53+
name: github-pages
54+
url: ${{ steps.deployment.outputs.page_url }}
55+
runs-on: ubuntu-latest
56+
needs: build
57+
steps:
58+
- name: Deploy to GitHub Pages
59+
id: deployment
60+
uses: actions/deploy-pages@v4

playground/vite.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ import { defineConfig } from "vite";
33

44
export default defineConfig({
55
plugins: [svelte()],
6-
});
6+
// GitHub Pages serves from /repo-name/ path
7+
// Replace 'styx-monorepo' with your actual repository name
8+
base: process.env.NODE_ENV === "production" ? "/styx-monorepo/" : "/",
9+
});

0 commit comments

Comments
 (0)