Skip to content

Commit e494fb1

Browse files
ryan-williamsclaude
andcommitted
ci: deploy demo to GitHub Pages on push to main (slidev.oa.dev)
Builds `demo/starter` and publishes `demo/starter/dist` via `actions/deploy-pages`, bound to the `slidev.oa.dev` custom domain via a generated `CNAME` file at the artifact root. Concurrency group `pages` so a flurry of pushes coalesces into one deploy; in-progress deploys aren't interrupted. Requires (one-time, in repo settings): - Settings → Pages → Source: GitHub Actions - Settings → Pages → Custom domain: slidev.oa.dev (Cloudflare DNS is already set) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 34dfbf2 commit e494fb1

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

.github/workflows/pages.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Deploy demo to GitHub Pages
2+
3+
# Publishes `demo/starter/dist` to GitHub Pages, served at `slidev.oa.dev` (CNAME).
4+
# Trigger: push to `main`, or manual run.
5+
6+
on:
7+
push:
8+
branches: [main]
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
# Allow only one concurrent deploy. New runs cancel a pending one (so a flurry of pushes
17+
# only deploys the latest), but don't interrupt an in-progress deploy.
18+
concurrency:
19+
group: pages
20+
cancel-in-progress: false
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Use Node.js 22
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: 22
32+
33+
# Mirrors the other workflows in this repo; @antfu/ni picks up the right package
34+
# manager from `pnpm-lock.yaml`.
35+
- name: Setup
36+
run: npm i -g @antfu/ni
37+
38+
- name: Install
39+
run: nci
40+
env:
41+
CYPRESS_INSTALL_BINARY: 0
42+
43+
- name: Build packages
44+
run: nr build
45+
46+
- name: Build demo
47+
run: pnpm -C demo/starter build
48+
49+
- name: Add CNAME
50+
# GH Pages reads CNAME from the artifact root to bind the custom domain.
51+
run: echo 'slidev.oa.dev' > demo/starter/dist/CNAME
52+
53+
- uses: actions/configure-pages@v5
54+
- uses: actions/upload-pages-artifact@v3
55+
with:
56+
path: demo/starter/dist
57+
58+
deploy:
59+
needs: build
60+
runs-on: ubuntu-latest
61+
environment:
62+
name: github-pages
63+
url: ${{ steps.deployment.outputs.page_url }}
64+
steps:
65+
- id: deployment
66+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)