From 7f6d3ee81d56358b94db2bb41033f573cbd72dea Mon Sep 17 00:00:00 2001 From: Stefaan Lippens Date: Wed, 12 Jun 2024 16:32:19 +0200 Subject: [PATCH] Issue #142 initial GitHub workflow for doc build+publish --- .github/workflows/docs2ghpages.yml | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/docs2ghpages.yml diff --git a/.github/workflows/docs2ghpages.yml b/.github/workflows/docs2ghpages.yml new file mode 100644 index 00000000..f160130b --- /dev/null +++ b/.github/workflows/docs2ghpages.yml @@ -0,0 +1,42 @@ +name: Build docs and push to GitHub Pages + +on: push + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.12 + + - name: Install dependencies (including Sphinx) + run: python -m pip install -r docs/requirements.txt + + - name: Sphinx build + # Build HTML documentation from sources under `docs` to `build` folder. + run: python -m sphinx -b html docs build + + - name: Commit documentation in gh-pages branch + # Store documentation in a temporary one-commit git repo. + run: | + cd build + git init -b gh-pages + touch .nojekyll + git config --local user.name "GitHub Actions Bot" + git config --local user.email "actions@github.com" + git add . + git commit -m "Update documentation" + + - name: Push gh-pages branch + # Push from the temporary repo to the `gh-pages` branch of your repo. + # Warning: this will overwrite any existing content and history + # of the `gh-pages` branch. + run: | + cd build + git push --force "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}" gh-pages + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}