-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (56 loc) · 2.02 KB
/
sync-tinyvue-docs.yml
File metadata and controls
62 lines (56 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: 同步TinyVue仓库内的文档进来
on:
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
copy-folders:
runs-on: ubuntu-latest
steps:
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: '10'
# 1、检出当前仓库
- name: Chheckout current repo
uses: actions/checkout@v4
with:
path: current-repo
token: ${{ secrets.MY_GITHUB_PUSH_TOKEN }} # 具有写入权限的令牌
# 2、检出TinyVue仓库
- name: Chheckout TinyVue repo
uses: actions/checkout@v4
with:
repository: opentiny/tiny-vue
path: tinyvue-repo
token: ${{ secrets.MY_GITHUB_PUSH_TOKEN }}
# 3、 复制文件夹
- name: copy copy-folders
run: |
# 清除当前
rm -rf current-repo/skills/tiny-vue-skill/apis
rm -rf current-repo/skills/tiny-vue-skill/demos
rm -rf current-repo/skills/tiny-vue-skill/webdoc
# 复制menus.js
cp tinyvue-repo/examples/sites/demos/pc/menus.js current-repo/skills/tiny-vue-skill/menus.js
# 复制apis
cp -r tinyvue-repo/examples/sites/demos/apis/. current-repo/skills/tiny-vue-skill/apis
# 复制demos
cp -r tinyvue-repo/examples/sites/demos/pc/app/. current-repo/skills/tiny-vue-skill/demos
# 复制apis
cp -r tinyvue-repo/examples/sites/demos/pc/webdoc/. current-repo/skills/tiny-vue-skill/webdoc
# 执行后处理脚本
cd current-repo/scripts
pnpm i
pnpm tiny-vue-skill-post-process
# 4、提交代码
- name: Commit
run: |
cd current-repo
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add .
# 只有在有更新时,才提交
git diff --quiet && git diff --staged --quiet || (git commit -m "同步TinyVue文档到SKills" && git push)