AMDS documentation tweaks (#113) #100
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: Sphinx Build | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
# Number of commits to fetch. 0 indicates all history for all branches and tags. | |
fetch-depth: '0' | |
- name: Install packages | |
run: | | |
sudo apt update | |
sudo apt upgrade -y | |
sudo apt install -y git make python3-pip | |
- name: Install Sphinx packages | |
run: pip install -r requirements.txt | |
- name: Build docs using Sphinx | |
run: | | |
make clean | |
make html | |
# Publish built docs to gh-pages branch. | |
# =============================== | |
- name: Commit documentation changes | |
run: | | |
rm -rf docs # not sure if this is needed... | |
mkdir docs | |
cp -rf build/html/* docs/ | |
cd docs | |
echo "docs.amdc.dev" > CNAME | |
touch .nojekyll # need this due to "_*" dirs getting ignored by GitHub | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "Update documentation" -a || true | |
# The above command will fail if no changes were present, so we ignore that. | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
branch: gh-pages | |
force: true | |
directory: docs | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
# =============================== | |