Skip to content

Commit c55418a

Browse files
committed
chore: github pages workflow to deploy demo
1 parent 89e205b commit c55418a

File tree

3 files changed

+52
-3
lines changed

3 files changed

+52
-3
lines changed

.github/workflows/build.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
on:
2+
# Runs on pushes targeting the default branch
3+
push:
4+
branches: [$default-branch]
5+
6+
# Allows you to run this workflow manually from the Actions tab
7+
workflow_dispatch:
8+
9+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
# Allow one concurrent deployment
16+
concurrency:
17+
group: "pages"
18+
cancel-in-progress: true
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
# https://github.com/actions/configure-pages
26+
- uses: actions/configure-pages@v2
27+
# https://github.com/actions/setup-node#usage
28+
- uses: actions/setup-node@v4
29+
with:
30+
node-version: 20
31+
cache: npm
32+
33+
- run: npm ci
34+
- run: npm run build
35+
# https://github.com/actions/upload-pages-artifact
36+
- uses: actions/upload-pages-artifact@v3
37+
with:
38+
path: "./apps/browser-example/dist/"
39+
40+
deploy:
41+
needs: build
42+
environment:
43+
name: github-pages
44+
url: ${{ steps.deployment.outputs.page_url }}
45+
runs-on: ubuntu-latest
46+
steps:
47+
# https://github.com/actions/deploy-pages & https://github.com/actions/starter-workflows/blob/main/pages/static.yml
48+
- uses: actions/deploy-pages@v4
49+
id: deployment

apps/browser-example/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "tsc -b && vite build",
9-
"clean": "rm -rf node_modules",
8+
"build": "rm -rf dist ; tsc -b && vite build",
9+
"clean": "rm -rf node_modules; rm -rf dist",
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"type": "module",
1111
"scripts": {
1212
"dev": "cd apps/react-example && npm run dev",
13-
"build": "tsc --build",
13+
"build": "npm run build --workspaces",
1414
"watch": "tsc --build --watch",
1515
"clean": "rm -rf node_modules && npm run clean --workspaces"
1616
},

0 commit comments

Comments
 (0)