Skip to content

Commit 95574ef

Browse files
committed
add workflow
1 parent 8e614bb commit 95574ef

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

.github/workflow/main.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: GenUI Book CI/CD
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main, preview]
8+
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
concurrency:
17+
group: pages
18+
cancel-in-progress: false
19+
jobs:
20+
# Build job
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0 # Not needed if lastUpdated is not enabled
28+
- uses: pnpm/action-setup@v3 # pnpm is optional but recommended, you can also use npm / yarn
29+
with:
30+
version: 8
31+
- name: Setup Node
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: 20
35+
cache: pnpm
36+
- name: Setup Pages
37+
uses: actions/configure-pages@v5
38+
if: github.repository_owner == 'project-robius-china'
39+
- name: Install dependencies
40+
run: pnpm install
41+
- name: Build with Rspress
42+
run: |
43+
pnpm run build
44+
- name: Upload artifact
45+
uses: actions/upload-pages-artifact@v3
46+
with:
47+
path: doc_build
48+
49+
# Deployment job
50+
deploy:
51+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
52+
environment:
53+
name: github-pages
54+
url: ${{ steps.deployment.outputs.page_url }}
55+
needs: build
56+
runs-on: ubuntu-latest
57+
name: Deploy
58+
steps:
59+
- name: Deploy to GitHub Pages
60+
id: deployment
61+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)