Sync and update docs from the main repo #5746
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |