Skip to content

Commit f9c1e6c

Browse files
committed
ci: add GitHub Actions workflow for Pages deployment
1 parent ed748ef commit f9c1e6c

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

.github/workflows/pages.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Deploy demo to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: true
16+
17+
jobs:
18+
deploy:
19+
environment:
20+
name: github-pages
21+
url: ${{ steps.deployment.outputs.page_url }}
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: 22
29+
cache: npm
30+
31+
- run: npm ci
32+
33+
- run: node build.js
34+
35+
# Assemble _site so demo/../dist paths resolve correctly:
36+
# _site/demo/index.html → href="../dist/nimble.css"
37+
# _site/dist/nimble.css
38+
- name: Assemble site
39+
run: |
40+
mkdir -p _site/demo _site/dist
41+
cp demo/* _site/demo/
42+
cp dist/* _site/dist/
43+
# Redirect root to demo page
44+
echo '<meta http-equiv="refresh" content="0;url=demo/">' > _site/index.html
45+
46+
- uses: actions/upload-pages-artifact@v3
47+
with:
48+
path: _site
49+
50+
- id: deployment
51+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)