forked from slidevjs/slidev
-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (62 loc) · 2.05 KB
/
Copy pathpages.yml
File metadata and controls
75 lines (62 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Deploy demo to GitHub Pages
# Publishes `demo/starter/dist` to GitHub Pages, served at `slidev.oa.dev` (CNAME).
# Trigger: push to `main`, or manual run.
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deploy. New runs cancel a pending one (so a flurry of pushes
# only deploys the latest), but don't interrupt an in-progress deploy.
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22
# Mirrors the other workflows in this repo; @antfu/ni picks up the right package
# manager from `pnpm-lock.yaml`.
- name: Setup
run: npm i -g @antfu/ni
- name: Install
run: nci
env:
CYPRESS_INSTALL_BINARY: 0
- name: Build packages
run: nr build
- name: Build demo
# `VITE_GIT_SHA` feeds the Install slide's `<InstallSnippet />` so the
# deployed slide shows a SHA that's actually live on `pkg.pr.new` for
# the corresponding deploy. Falls back to `git rev-parse` locally.
run: pnpm -C demo/starter build
env:
VITE_GIT_SHA: ${{ github.sha }}
- name: Add CNAME
# GH Pages reads CNAME from the artifact root to bind the custom domain.
run: echo 'slidev.oa.dev' > demo/starter/dist/CNAME
- uses: actions/configure-pages@v5
# Auto-create the Pages site on first run instead of failing if the repo doesn't
# have Pages enabled yet. Requires `pages: write` (already set above).
with:
enablement: true
- uses: actions/upload-pages-artifact@v3
with:
path: demo/starter/dist
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4