-
Notifications
You must be signed in to change notification settings - Fork 1
44 lines (42 loc) · 1.76 KB
/
pull-doc.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
name: pull-doc-from-circleci
on:
repository_dispatch:
types: [circle-ci-build]
jobs:
pull-doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout pypose/pypose.github.io
with:
path: 'repo'
fetch-depth: 0 # per instruction of https://github.com/marketplace/actions/github-push
persist-credentials: false
- name: Download built documentation
id: download_doc
run: |
export CIRCLE_TOKEN=?circle-token=${{ secrets.BOT_CIRCLECI_PAT }}
export ARTIFACTS=$(curl -sS https://circleci.com/api/v1.1/project/github/pypose/pypose/${{ github.event.client_payload.job_num }}/artifacts$CIRCLE_TOKEN)
echo "ARTIFACTS=${ARTIFACTS}"
wget -q -O sphinx-docs.tar.gz $(echo $ARTIFACTS | grep -o 'https://[^"]*')$CIRCLE_TOKEN
mkdir sphinx-docs && tar -xf sphinx-docs.tar.gz -C sphinx-docs
# move to docs/pr/<pr number> if is from pr
PR_NUM="${{ github.event.client_payload.pr_num }}"
echo "PR_NUM=${PR_NUM}"
[[ ! -z "$PR_NUM" ]] && DEST_SUFFIX="preview/pr/$PR_NUM" || DEST_SUFFIX="main"
echo "DEST_SUFFIX=${DEST_SUFFIX}"
mkdir -p repo/docs/$DEST_SUFFIX
rsync -a sphinx-docs/build/dirhtml/ repo/docs/$DEST_SUFFIX --delete --exclude preview
- name: Commit files
run: |
cd repo
git config --local user.email "[email protected]"
git config --local user.name "pyposebot"
git add docs
git commit --allow-empty -m "Add docs from pypose/pypose"
- name: Push changes
uses: ad-m/github-push-action@master
with:
directory: repo
branch: main
github_token: ${{ secrets.BOT_GH_PAT }}