Add note about jQuery #178
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: Docs | |
on: [push, ] | |
jobs: | |
build_docs: | |
name: Build and Deploy Documentation | |
runs-on: ubuntu-20.04 | |
container: | |
# We run this workflow in a docker container that has a full LaTeX | |
# environment installed, so that we can build the PDF version of the | |
# documentation | |
image: docker.pkg.github.com/goerz-docker/docs-build-env/docs-build-env:latest | |
credentials: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build the docs | |
id: build | |
run: | | |
set -x | |
python -m pip install -e .[dev] | |
python -m pip install zip-files | |
export VERSION=$(python -c 'import docs_versions_menu; print(docs_versions_menu.__version__, end="")') | |
python -m sphinx -W "docs/" -d "docs/_build/doctree" "docs/_build/html" | |
python -m sphinx -W "docs/" -d "docs/_build/doctree" -b latex "docs/_build/latex" | |
python docs/build_pdf.py docs/_build/latex/docsversionsmenu.tex | |
python -m sphinx -W "docs/" -d "docs/_build/doctree" -b epub docs/_build/epub | |
zip-folder --debug --auto-root --outfile "docs-versions-menu-$VERSION.zip" docs/_build/html | |
mv docs/_build/latex/docsversionsmenu.pdf "docs-versions-menu-$VERSION.pdf" | |
mv docs/_build/epub/DocsVersionsMenu.epub "docs-versions-menu-$VERSION.epub" | |
touch docs/_build/html/_downloads | |
echo ::set-output name=VERSION::$VERSION | |
- name: Make a Github release and set _downloads links | |
shell: bash | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
set -x | |
git fetch --tags --force # restore tag info that actions/checkout pruned | |
tag_name="${GITHUB_REF##*/}" | |
release_title=$(git tag -l --format='%(contents:subject)' "$tag_name") | |
git tag -l --format='%(contents:body)' "$tag_name" | tee RELEASE_NOTES.md | |
gh release create "$tag_name" ./docs-versions-menu-${{ steps.build.outputs.VERSION }}.* --notes-file RELEASE_NOTES.md --title="$release_title" | |
epub=$(gh api "repos/${{ github.repository }}/releases/tags/$tag_name" | jq '.assets[] | .browser_download_url' | sed 's/"//g' | grep 'epub$') | |
pdf=$(gh api "repos/${{ github.repository }}/releases/tags/$tag_name" | jq '.assets[] | .browser_download_url' | sed 's/"//g' | grep 'pdf$') | |
zip=$(gh api "repos/${{ github.repository }}/releases/tags/$tag_name" | jq '.assets[] | .browser_download_url' | sed 's/"//g' | grep 'zip$') | |
echo "[html]: $zip" >> docs/_build/html/_downloads | |
echo "[epub]: $epub" >> docs/_build/html/_downloads | |
echo "[pdf]: $pdf" >> docs/_build/html/_downloads | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Deploy documentation to gh-pages | |
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rtd-theme' || startsWith(github.ref, 'refs/tags/') | |
shell: bash | |
run: | | |
set -x | |
# Clone gh-pages | |
git clone --branch gh-pages https://github.com/${{ github.repository }} gh-pages | |
# Run rsync | |
branch_name=$(echo ${GITHUB_REF##*/} | tr / -) | |
rsync -av --delete "./docs/_build/html/" "./gh-pages/$branch_name/" | |
# Run docs-versions-menu | |
cd gh-pages | |
docs-versions-menu | |
# Commit and push | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add -A --verbose | |
git status | |
git log --format=%B -n 1 | tee .git/_github_actions_commit_msg | |
loglastline=$(cat .git/_github_actions_commit_msg | grep -v '^$' | tail -n1) | |
logauthor=$(git log --format=%an -n 1) | |
if [[ "$logauthor" == "github-actions"* && "$loglastline" == *"${{ github.ref }}"* ]]; | |
then | |
# we ammend if the previous commit was down by Github Actions and was based on the same branch/tag name | |
echo "Amending previous commit" | |
echo "Deployed from commit ${GITHUB_SHA} (${GITHUB_REF})" >> .git/_github_actions_commit_msg | |
git commit --verbose --amend -F .git/_github_actions_commit_msg | |
else | |
echo "Making new commit" | |
git commit --verbose -m "Auto-update from Github Actions Workflow" -m "Deployed from commit ${GITHUB_SHA} (${GITHUB_REF})" | |
fi | |
git log -n 1 | |
git push --verbose --force https://$GITHUB_ACTOR:[email protected]/${{ github.repository }} gh-pages | |
env: | |
DOCS_VERSIONS_MENU_DEBUG: 'true' | |
DOCS_VERSIONS_MENU_VERSIONS: '(<branches> != (master, rtd-theme)), (<releases>)[:-1], rtd-theme, (<releases>)[-1], master' | |
DOCS_VERSIONS_MENU_LABEL: 'rtd-theme: v0.5.2 (rtd-theme)' | |
DOCS_VERSIONS_MENU_WARNING: 'unreleased: (<branches> != rtd-theme), <local-releases>' | |
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/upload-artifact@v2 | |
name: Upload documentation artifacts | |
with: | |
name: docs | |
path: | | |
RELEASE_NOTES.md | |
./docs/_build/html/_downloads | |
./docs-versions-menu-${{ steps.build.outputs.VERSION }}.* |