Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dumirc.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// more config: https://d.umijs.org/config
import { defineConfig } from 'dumi';

const basePath = process.env.GITHUB_ACTIONS ? '/cssinjs/' : '/';
const publicPath = process.env.GITHUB_ACTIONS ? '/cssinjs/' : '/';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不用判断 env,直接加上就好

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

开发者本地构建后。 preview 可能有问题。我需要验证一下。cc @PeachScript

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我需要验证一下

验证了一下,本地构建后想 preview 会有问题。个人建议还是保留~

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以参考一下 rc-mentions 的 preview 部署

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我需要验证一下

验证了一下,本地构建后想 preview 会有问题。个人建议还是保留~

这样本地构建推上去是不对的

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以参考一下 rc-mentions 的 preview 部署

好滴~

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/react-component/mentions/blob/master/.dumirc.ts#L14-L15 是指这里的逻辑么? 本地构建后错误的。是不是和 dumi 版本有关系。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

说错了,看 color-picker 吧,https://github.com/react-component/color-picker/blob/master/.dumirc.ts#L4
preview 构建加环境变量


export default defineConfig({
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
themeConfig: {
Expand All @@ -9,4 +12,6 @@ export default defineConfig({
},
outputPath: '.doc',
exportStatic: {},
base: basePath,
publicPath: publicPath,
});
39 changes: 39 additions & 0 deletions .github/workflows/site-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy website
on:
push:
tags:
- '*'
workflow_dispatch:

permissions:
contents: write

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3

- name: setup node
uses: actions/setup-node@v1
with:
node-version: 14

- name: create package-lock.json
run: npm i --package-lock-only --ignore-scripts

- name: Install dependencies
run: npm ci

- name: build Docs
run: npm run docs:build

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./.doc
force_orphan: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,8 @@
"scripts": {
"start": "dumi dev",
"docs:build": "dumi build",
"docs:deploy": "gh-pages -d .doc",
"compile": "father build",
"gh-pages": "npm run docs:build && npm run docs:deploy",
"prepublishOnly": "npm run compile && np --yolo --no-publish",
"postpublish": "npm run gh-pages",
"lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md",
"prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
"pretty-quick": "pretty-quick",
Expand Down Expand Up @@ -64,7 +61,6 @@
"dumi": "^2.1.13",
"eslint": "^7.0.0",
"father": "^4.0.0",
"gh-pages": "^3.1.0",
"husky": "^4.2.5",
"np": "^7.0.0",
"prettier": "^2.0.5",
Expand Down