Skip to content

circle-ci-build

circle-ci-build #1098

Workflow file for this run

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 }}