-
Notifications
You must be signed in to change notification settings - Fork 32
109 lines (96 loc) · 3.75 KB
/
doc-sync.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Sync and update docs from the main repo
on:
schedule:
# update it every day at 00:00
- cron: '0 */3 * * *'
workflow_dispatch:
jobs:
sync-docs:
strategy:
max-parallel: 2
runs-on: "ubuntu-20.04"
steps:
- name: Checkout Taichi main repo
uses: actions/checkout@v2
with:
repository: taichi-dev/taichi
path: source
- name: Checkout Taichi Autoapi Gen
uses: actions/checkout@v2
with:
repository: taichi-dev/docstring-gen
path: docsgen
- name: Checkout Taichi docs repo
uses: actions/checkout@v2
with:
repository: taichi-dev/docs.taichi.graphics
path: target
- name: Checkout Taichi blog repo
uses: actions/checkout@v2
with:
repository: taichi-dev/blogs
path: _blogs
- name: Install Dependences
run: sudo apt-get install -y jq
- name: Set Env
run: |
echo "DOCSTRING_GEN_PATH=${GITHUB_WORKSPACE}/docsgen" >> $GITHUB_ENV
echo "TAICHI_PATH=${GITHUB_WORKSPACE}/source/python/taichi" >> $GITHUB_ENV
echo "TAICHI_MAIN=${GITHUB_WORKSPACE}/source" >> $GITHUB_ENV
echo "TAICHI_WEBSITE=${GITHUB_WORKSPACE}/target" >> $GITHUB_ENV
echo "TAICHI_BLOG=${GITHUB_WORKSPACE}/_blogs" >> $GITHUB_ENV
export DOCSTRING_GEN_PATH=${{ env.DOCSTRING_GEN_PATH }}
export TAICHI_PATH=${{ env.TAICHI_PATH }}
export TAICHI_WEBSITE=${{ env.TAICHI_WEBSITE }}
export TAICHI_MAIN=${{ env.TAICHI_MAIN }}
export TAICHI_BLOG=${{ env.TAICHI_BLOG }}
- name: Export Env
run: |
export DOCSTRING_GEN_PATH=${{ env.DOCSTRING_GEN_PATH }}
export TAICHI_PATH=${{ env.TAICHI_PATH }}
export TAICHI_WEBSITE=${{ env.TAICHI_WEBSITE }}
export TAICHI_MAIN=${{ env.TAICHI_MAIN }}
export TAICHI_BLOG=${{ env.TAICHI_BLOG }}
- name: Sync and stage changes
run: |
cd $TAICHI_PATH && git fetch --tags
cd $TAICHI_WEBSITE/website && ./sync_docs.sh
rsync -avh --delete $TAICHI_BLOG/blogs/ $TAICHI_WEBSITE/website/blog
- name: Generate New API Docs AND Sync To Docs Website
run: |
$DOCSTRING_GEN_PATH/multi_version_build.sh
- name: Create a Pull Request
id: create-pr
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GARDENER_PAT }}
path: target
commit-message: Sync and update documentation content.
committer: Taichi Gardener <[email protected]>
author: Taichi Gardener <[email protected]>
signoff: false
base: master
branch: sync-documentation
delete-branch: true
draft: false
title: '[Cron] Sync and update documentation content'
body: |
- Synced with *today's* date.
- Auto-generated.
- Will be auto-merged.
labels: |
automation
- name: Enable auto-merge on the Pull Request
if: steps.create-pr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v1
with:
token: ${{ secrets.GARDENER_PAT }}
pull-request-number: ${{ steps.create-pr.outputs.pull-request-number }}
merge-method: squash
- name: Auto approve the Pull Request
if: steps.create-pr.outputs.pull-request-operation == 'created'
uses: juliangruber/approve-pull-request-action@v1
with:
# we use Action Bot to approve since you can't approve your own PR
github-token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.create-pr.outputs.pull-request-number }}