Skip to content

Commit 398ba27

Browse files
authored
Merge dbf5367 into 490f5cd
2 parents 490f5cd + dbf5367 commit 398ba27

File tree

4 files changed

+51
-3
lines changed

4 files changed

+51
-3
lines changed

.dumirc.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
// more config: https://d.umijs.org/config
22
import { defineConfig } from 'dumi';
33

4+
const name = 'cssinjs';
5+
6+
const isProdSite =
7+
// 不是预览模式 同时是生产环境
8+
process.env.PREVIEW !== 'true' && process.env.NODE_ENV === 'production';
9+
410
export default defineConfig({
511
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
612
themeConfig: {
7-
name: 'cssinjs',
13+
name,
814
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
915
},
1016
outputPath: '.doc',
1117
exportStatic: {},
18+
base: isProdSite ? `/${name}/` : '/',
19+
publicPath: isProdSite ? `/${name}/` : '/',
1220
});

.github/workflows/preview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ jobs:
1515
dist: .doc
1616
build: |
1717
npm install
18-
npm run docs:build
18+
npm run docs:preview
1919
- name: Get the preview_url
2020
run: echo "url => ${{ steps.preview_step.outputs.preview_url }}"

.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 docs: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'

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727
"start": "dumi dev",
2828
"docs:build": "dumi build",
2929
"docs:deploy": "gh-pages -d .doc",
30+
"docs:preview": "PREVIEW=true npm run docs:build",
3031
"compile": "father build",
31-
"gh-pages": "npm run docs:build && npm run docs:deploy",
32+
"gh-pages": "npm run docs:build",
3233
"prepublishOnly": "npm run compile && np --yolo --no-publish",
3334
"postpublish": "npm run gh-pages",
3435
"lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md",

0 commit comments

Comments
 (0)