Skip to content

Commit 0b674b8

Browse files
authored
chore(site): add site deploy (#7)
* chore(site): add site deploy * chore: update scripts
1 parent 709a2b3 commit 0b674b8

File tree

8 files changed

+52
-2
lines changed

8 files changed

+52
-2
lines changed

.github/workflows/site-deploy.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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-20.04
14+
strategy:
15+
matrix:
16+
node-version: [16]
17+
steps:
18+
- uses: actions/checkout@v3
19+
- uses: pnpm/action-setup@v2
20+
with:
21+
version: 7
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
cache: 'pnpm'
27+
- name: Install dependencies
28+
run: pnpm install
29+
30+
- name: build Docs
31+
run: pnpm run build:docs
32+
33+
- name: Deploy to GitHub Pages
34+
uses: peaceiris/actions-gh-pages@v3
35+
with:
36+
github_token: ${{ secrets.GITHUB_TOKEN }}
37+
publish_dir: ./.doc
38+
force_orphan: true
39+
user_name: 'github-actions[bot]'
40+
user_email: 'github-actions[bot]@users.noreply.github.com'

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ dist
3030
es
3131
lib
3232
.umi
33+
.doc

config/config.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ import type { IConfig } from 'dumi'
33
import { menus } from './menus'
44
import { navs } from './navs'
55

6+
const basePath = process.env.GITHUB_ACTIONS ? '/react-ui-library/' : '/';
7+
const publicPath = process.env.GITHUB_ACTIONS ? '/react-ui-library/' : '/';
8+
69
const resolvePath = (dir: string) => path.resolve(process.cwd(), dir)
710

811
const config: IConfig = {
9-
base: '/',
10-
publicPath: '/',
12+
base: basePath,
13+
publicPath,
1114
exportStatic: {},
15+
outputPath: '.doc',
1216
nodeModulesTransform: {
1317
type: 'none',
1418
exclude: [],

packages/desktop-ui/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
],
1313
"scripts": {
1414
"build": "gulp",
15+
"prepublishOnly": "pnpm run build",
1516
"release": "bumpp --tag @template-pro/desktop-ui@%s --all --no-verify && pnpm publish"
1617
},
1718
"peerDependencies": {

packages/icons/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"clean": "gulp clean",
1919
"build:svg": "gulp copy && svgr --template scripts/buildIconTemplate.js --typescript --out-dir src temp",
2020
"build": "pnpm run clean && pnpm run build:svg && gulp",
21+
"prepublishOnly": "pnpm run build",
2122
"release": "bumpp --tag @template-pro/icons@%s --all --no-verify && pnpm publish"
2223
},
2324
"publishConfig": {

packages/mobile-ui/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
],
1919
"scripts": {
2020
"build": "gulp",
21+
"prepublishOnly": "pnpm run build",
2122
"release": "bumpp --tag @template-pro/mobile-ui@%s --all --no-verify && pnpm publish"
2223
},
2324
"peerDependencies": {

packages/rc-ui/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
],
1414
"scripts": {
1515
"build": "gulp",
16+
"prepublishOnly": "pnpm run build",
1617
"release": "bumpp --tag @template-pro/rc-ui@%s --all --no-verify && pnpm publish"
1718
},
1819
"peerDependencies": {

packages/utils/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
],
1717
"scripts": {
1818
"build": "gulp",
19+
"prepublishOnly": "pnpm run build",
1920
"release": "bumpp --tag @template-pro/utils@%s --all --no-verify && pnpm publish"
2021
},
2122
"publishConfig": {

0 commit comments

Comments
 (0)