adds a note on building and running tests #115
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: Publish documentation | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
jobs: | |
deploydocs: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 32 | |
permissions: | |
# NOTE: Needed to push to the repository. | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: polytracker | |
- name: Get the version | |
id: get_version | |
run: echo "::set-env name=VERSION::${GITHUB_REF#refs/*/}" | |
env: | |
# The use of ::set-env here is safe! | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' | |
- name: Set up Python 3.x | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
cd polytracker | |
python -m pip install --upgrade pip | |
pip install setuptools | |
pip install .[dev] | |
- name: Build documentation | |
run: | | |
cd polytracker/docs | |
make html | |
- name: Checkout gh-pages branch | |
uses: actions/checkout@v3 | |
with: | |
ref: gh-pages | |
path: gh-pages | |
fetch-depth: 0 | |
- name: Commit documentation changes | |
run: | | |
cd gh-pages | |
git pull | |
rm -rf ${VERSION} | |
mkdir ${VERSION} | |
cp -r ../polytracker/docs/_build/html/* ${VERSION}/ | |
cd ${VERSION} | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add . | |
if [ "$GITHUB_REF" == "refs/heads/master" ]; then | |
cd .. | |
# This is not tag, so it is the latest: | |
rm -f latest | |
ln -s ${VERSION} latest | |
git add latest | |
fi | |
git commit -m "Update documentation for ${GITHUB_REF}" -a || true | |
# The above command will fail if no changes were present, so we ignore | |
# the return code. | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
branch: gh-pages | |
directory: gh-pages | |
github_token: ${{ secrets.GITHUB_TOKEN }} |