Merge pull request #39 from thermondo/custom-requests-sessoin #23
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-deploy | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
# on documentation change (changelog & contribution guidlines are a part of that) | |
- 'docs/**' | |
- 'CHANGELOG.md' | |
- 'CONTRIBUTING.md' | |
# also when docstrings in the source code change | |
- 'src/**' | |
jobs: | |
docs: | |
name: Sphinx Docs & Release on GitHub Pages | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
pip install -r requirements-dev.txt | |
- name: Generate Sphinx Documentation | |
run: | | |
cd docs | |
make html SPHINXOPTS="-W --keep-going" | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: sphinx-docs | |
path: docs/build/html/ | |
- name: Commit Documentation Changes | |
run: | | |
set -uex | |
# clone just branch "gh-pages" in local folder "gh-pages" | |
git clone https://github.com/at-gmbh/personio-py --branch gh-pages --single-branch gh-pages | |
# delete existing files | |
cd gh-pages | |
ls | grep -v "README.md" | xargs rm -rf | |
# copy new files | |
cp -r ../docs/build/html/* . | |
# add all files to git & commit | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add . | |
# this command will fail if no changes were present, so we ignore that. | |
git commit -m "update documentation" -a || true | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
branch: gh-pages | |
directory: gh-pages | |
github_token: ${{ secrets.GITHUB_TOKEN }} |