Skip to content

Commit

Permalink
feat: 添加文档框架
Browse files Browse the repository at this point in the history
* feat: 添加文档框架

* ci: 修改发布触发条件

* ci: 新增自动分配 reviewers action

* ci: 修改 action 版本号

* ci: 规范 action 名称

* upgrade: 更新依赖

* ci: 修改 pr 文档部署触发条件

* ci: 新增基于 Netlify 的文档

* ci: 移除基于 surge 的文档预览

* ci: 修改分配 reviewer 的时机

* ci: 修改 token 设置

* ci: 修改获取 token 的方式

---------

Co-authored-by: liu <liunian7965@navinfo.com>
  • Loading branch information
liunnn1994 and liu authored May 30, 2023
1 parent ff2a007 commit 1960f59
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 223 deletions.
9 changes: 9 additions & 0 deletions .github/auto_assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
addReviewers: true
addAssignees: author
numberOfReviewers: 2
skipKeywords:
- wip
reviewers:
- liunnn1994
- alanwhy
- maguangweii
11 changes: 6 additions & 5 deletions .github/workflows/pr-auto-assign.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "PR Auto Assign"
name: "PR Auto Assign And Review"
on:
pull_request:
types: [opened, ready_for_review]
types: [opened, edited, reopened, ready_for_review]

jobs:
add-reviews:
Expand Down Expand Up @@ -34,9 +34,10 @@ jobs:
run: yarn --frozen-lockfile

- name: Generate config
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node ./scripts/generateAutoAssignConfig.cjs
run: |
touch .env.vault
echo GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} >> .env.vault
node ./scripts/generateAutoAssignConfig.cjs
- uses: kentaro-m/auto-assign-action@v1.2.5
with:
Expand Down
88 changes: 0 additions & 88 deletions .github/workflows/pr-docs-build.yml

This file was deleted.

90 changes: 0 additions & 90 deletions .github/workflows/pr-docs-deploy.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/pr-docs-start.yml

This file was deleted.

26 changes: 5 additions & 21 deletions .github/workflows/publish-docs-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ on:
workflow_run:
workflows: ["Publish to NPM registry"]
types: [completed]

paths:
- "docs/**/*"
- "package.json"
jobs:
deploy-docs:
runs-on: ubuntu-latest
Expand All @@ -17,23 +19,5 @@ jobs:
ref: ${{ github.event.workflow_run.head_sha }}
persist-credentials: false

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18

- name: Get yarn store directory
id: yarn-cache
run: |
echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup yarn cache
with:
path: ${{ steps.yarn-cache.outputs.yarn_cache_dir }}
key: ${{ runner.os }}-yarn-store-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-store-
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Start Netlify Build
run: curl -X POST -d '{}' $NETLIFY_BUILD_HOOKS
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"scripts": {
"build": "npm run banner && npm run build:type && npm run build:vite",
"build:vite": "vite build",
"docs:build": "vitepress build docs",
"build:type": "npm run clear:type && tsc --declaration --emitDeclarationOnly --project tsconfig.build.json",
"banner": "node build/create-banner.js",
"clear:type": "rimraf ./types",
Expand All @@ -23,6 +22,7 @@
"publishOnly": "npm run build && npm run docs:build",
"semantic-release": "semantic-release",
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:preview": "vitepress preview docs"
},
"repository": "git@github.com:NI-Web-Infra-Team/common-util.git",
Expand Down Expand Up @@ -74,6 +74,7 @@
"c8": "^7.14.0",
"commitizen": "^4.3.0",
"dayjs": "^1.11.7",
"dotenv": "^16.0.3",
"eslint": "^8.41.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
Expand Down
3 changes: 3 additions & 0 deletions scripts/generateAutoAssignConfig.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ const { readFileSync, writeFileSync } = require("node:fs");
const { Octokit } = require("octokit");
const YAML = require("yaml");

const dotenv = require("dotenv");
dotenv.config({ path: join(process.cwd(), ".env.vault") });

const ignoreList = ["ni-team-bot"];

const templateFile = join(process.cwd(), "scripts/templates/auto_assign.yml");
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3195,6 +3195,11 @@ dot-prop@^5.1.0:
dependencies:
is-obj "^2.0.0"

dotenv@^16.0.3:
version "16.0.3"
resolved "https://registry.npmmirror.com/dotenv/-/dotenv-16.0.3.tgz#115aec42bac5053db3c456db30cc243a5a836a07"
integrity sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==

duplexer2@~0.1.0:
version "0.1.4"
resolved "https://registry.npmmirror.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1"
Expand Down

0 comments on commit 1960f59

Please sign in to comment.