This repository has been archived by the owner on Mar 19, 2024. It is now read-only.
Release 3.47.0. #8
Workflow file for this run
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: API docs | |
on: | |
push: | |
tags: ['[0-9]+.[0-9]+*'] | |
permissions: | |
contents: write | |
# setup-python no longer supports Python 2.7; use a Docker image instead | |
# The available Python 2.7 Docker images don't support the --field-separator awk option | |
# Therefore, split the action into two jobs | |
jobs: | |
api-docs: | |
runs-on: ubuntu-latest | |
container: | |
image: python:2.7.18-buster | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
path: code | |
persist-credentials: false | |
- name: Install Sphinx and dependencies | |
run: pip install sphinx requests==2.* requests-toolbelt==0.* | |
- name: Build API docs | |
run: sphinx-build . docs | |
working-directory: code | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: docs | |
path: code/docs | |
retention-days: 1 | |
deploy: | |
runs-on: ubuntu-latest | |
needs: ['api-docs'] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: docs | |
path: code/docs | |
- name: Checkout pages | |
uses: actions/checkout@v3 | |
with: | |
ref: gh-pages | |
path: pages | |
- name: Deploy pages | |
run: | | |
SDK_VERSION_FOLDER=`echo "$SDK_VERSION" | awk --field-separator '.' '{print $1".x";}'` | |
# Create .nojekyll if it doesn't exist yet | |
touch .nojekyll | |
mkdir -p "$SDK_VERSION_FOLDER" | |
rsync --quiet --archive --checksum --delete --exclude .git ../code/docs/ "$SDK_VERSION_FOLDER/" | |
# Remove .buildinfo and .doctrees generated by Sphinx | |
if [ -f "$SDK_VERSION_FOLDER/.buildinfo" ]; then rm "$SDK_VERSION_FOLDER/.buildinfo"; fi | |
if [ -d "$SDK_VERSION_FOLDER/.doctrees" ]; then rm -r "$SDK_VERSION_FOLDER/.doctrees"; fi | |
if [ -e latest ]; then rm -r latest; fi | |
ln -s "$SDK_VERSION_FOLDER" latest | |
git config user.email "$USER_EMAIL" | |
git config user.name "$USER_NAME" | |
git add --all . | |
# Only commit when there are changes | |
git diff --quiet && git diff --staged --quiet || git commit --message "Generated API docs for version ${SDK_VERSION}" | |
git push | |
shell: bash | |
working-directory: pages | |
env: | |
SDK_VERSION: ${{ github.ref_name }} | |
USER_EMAIL: ${{ github.event.pusher.email }} | |
USER_NAME: ${{ github.event.pusher.name }} |