Update README.rst #287
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: Deploy GitHub pages | |
on: | |
pull_request: | |
push: | |
branches: main | |
jobs: | |
build_docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Generate HTML docs | |
uses: ax3l/sphinx-action@newer-sphinx | |
env: | |
ALLOW: --allow-run-as-root | |
with: | |
docs-folder: "docs/" | |
pre-build-command: | | |
apt-get update | |
apt-get install -y git libopenmpi-dev openmpi-bin | |
pip install -e .[doc] | |
echo "localhost slots=50">hostfile | |
- name: Upload generated HTML as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: DocHTML | |
path: docs/_build/html/ | |
deploy_docs: | |
if: github.ref == 'refs/heads/main' | |
needs: | |
build_docs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: DocHTML | |
path: docs/_build/html/ | |
- name: Commit to documentation branch | |
run: | | |
git clone --no-checkout --depth 1 https://github.com/${{ github.repository_owner }}/dicodile.git --branch gh-pages --single-branch gh-pages | |
cp -r docs/_build/html/* gh-pages/ | |
cd gh-pages | |
touch .nojekyll | |
git config --local user.email "dicodile@github.com" | |
git config --local user.name "dicodile GitHub Action" | |
git add . | |
git commit -m "Update documentation" -a || true | |
- name: Push changes | |
uses: ad-m/github-push-action@v0.6.0 | |
with: | |
branch: gh-pages | |
directory: gh-pages | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |