-
Notifications
You must be signed in to change notification settings - Fork 19
76 lines (64 loc) · 2.36 KB
/
preview.yml
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Update preview branch
on:
# push:
# branches: ["main"]
# paths-ignore:
# - ".github/**"
workflow_dispatch
concurrency: update-preview-branch
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: "main"
path: "main"
- uses: actions/checkout@v3
with:
ref: "preview"
path: "preview"
- name: Init git info
run: |
cd preview
git status
git config user.name github-actions
git config user.email [email protected]
- name: Update preview branch files
run: |
sudo rm -fr ./preview/markdown-pages/*
sudo rm -fr ./preview/docs.json
cp -rip ./main/docs.json ./preview/docs.json
mkdir -p ./preview/markdown-pages/en/tidb
mkdir -p ./preview/markdown-pages/ja/tidb
mkdir -p ./preview/markdown-pages/en/tidbcloud
mkdir -p ./preview/markdown-pages/zh/tidb
cp -rip ./main/markdown-pages/en/tidb/master ./preview/markdown-pages/en/tidb/master
cp -rip ./main/markdown-pages/en/tidb/release-8.1 ./preview/markdown-pages/en/tidb/release-8.1
cp -rip ./main/markdown-pages/en/tidbcloud ./preview/markdown-pages/en/
cp -rip ./main/markdown-pages/zh/tidb/release-8.1 ./preview/markdown-pages/zh/tidb/release-8.1
cp -rip ./main/markdown-pages/zh/tidb/master ./preview/markdown-pages/zh/tidb/master
cp -rip ./main/markdown-pages/ja/tidb/release-8.1 ./preview/markdown-pages/ja/tidb/release-8.1
cp -rip ./main/markdown-pages/ja/tidbcloud ./preview/markdown-pages/ja/
- name: Git commit and push
run: |
cd preview
git add markdown-pages
git add docs.json
git fetch
git pull
if [[ -z $(git status -s) ]]
then
git status
else
git commit -m "update MDs by main branch"
fi
git push
# - name: Trigger website-docs-preview
# run: |
# curl \
# -X POST \
# -H "Accept: application/vnd.github+json" \
# -H "Authorization: token ${{ secrets.GH_TOKEN }}" \
# https://api.github.com/repos/pingcap/website-docs/actions/workflows/preview.yml/dispatches \
# -d '{"ref":"master","inputs":{}'