Skip to content

Commit d43752a

Browse files
authored
ci: add docs deploy workflow (#297)
* ci: add docs deploy workflow * update trigger event
1 parent 86a090a commit d43752a

File tree

3 files changed

+48
-6
lines changed

3 files changed

+48
-6
lines changed

.dumirc.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
import { defineConfig } from 'dumi';
33
import path from 'path';
44

5+
const basePath = process.env.GITHUB_ACTIONS ? '/collapse/' : '/';
6+
const publicPath = process.env.GITHUB_ACTIONS ? '/collapse/' : '/';
7+
58
export default defineConfig({
69
alias: {
710
'rc-collapse$': path.resolve('src'),
@@ -14,4 +17,6 @@ export default defineConfig({
1417
},
1518
outputPath: '.doc',
1619
exportStatic: {},
20+
base: basePath,
21+
publicPath,
1722
});

.github/workflows/react-component-ci.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646

4747
lint:
4848
runs-on: ubuntu-latest
49+
needs: setup
4950
steps:
5051
- name: checkout
5152
uses: actions/checkout@master
@@ -65,10 +66,10 @@ jobs:
6566
- name: lint
6667
run: npm run lint
6768

68-
needs: setup
6969

7070
compile:
7171
runs-on: ubuntu-latest
72+
needs: setup
7273
steps:
7374
- name: checkout
7475
uses: actions/checkout@master
@@ -87,11 +88,10 @@ jobs:
8788

8889
- name: compile
8990
run: npm run compile
90-
91-
needs: setup
9291

9392
coverage:
9493
runs-on: ubuntu-latest
94+
needs: setup
9595
steps:
9696
- name: checkout
9797
uses: actions/checkout@master
@@ -109,6 +109,4 @@ jobs:
109109
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
110110

111111
- name: coverage
112-
run: npm test -- --coverage && bash <(curl -s https://codecov.io/bash)
113-
114-
needs: setup
112+
run: npm run coverage && bash <(curl -s https://codecov.io/bash)

.github/workflows/site-deploy.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Deploy website
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-and-deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: checkout
16+
uses: actions/checkout@v3
17+
18+
- name: setup node
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: 14
22+
23+
- name: create package-lock.json
24+
run: npm i --package-lock-only --ignore-scripts
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: build Docs
30+
run: npm run build
31+
32+
- name: Deploy to GitHub Pages
33+
uses: peaceiris/actions-gh-pages@v3
34+
with:
35+
github_token: ${{ secrets.GITHUB_TOKEN }}
36+
publish_dir: ./.doc
37+
force_orphan: true
38+
user_name: 'github-actions[bot]'
39+
user_email: 'github-actions[bot]@users.noreply.github.com'

0 commit comments

Comments
 (0)