From 25ae3e908e0772367d4e23a6d03773ac33979eb7 Mon Sep 17 00:00:00 2001 From: John Lees Date: Tue, 12 Dec 2023 09:17:39 +0000 Subject: [PATCH] Add actions for docs build --- .github/workflows/docs_pr.yml | 20 +++++++++++++++ .github/workflows/docs_push.yml | 44 +++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 .github/workflows/docs_pr.yml create mode 100644 .github/workflows/docs_push.yml diff --git a/.github/workflows/docs_pr.yml b/.github/workflows/docs_pr.yml new file mode 100644 index 00000000..ff1787ca --- /dev/null +++ b/.github/workflows/docs_pr.yml @@ -0,0 +1,20 @@ +name: "Pull Request Docs Check" + +on: [pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + - uses: ammaraskar/sphinx-action@master + with: + docs-folder: "docs/" + + - uses: actions/upload-artifact@v1 + with: + name: DocumentationHTML + path: docs/_build/html/ diff --git a/.github/workflows/docs_push.yml b/.github/workflows/docs_push.yml new file mode 100644 index 00000000..ad787873 --- /dev/null +++ b/.github/workflows/docs_push.yml @@ -0,0 +1,44 @@ +name: CI + +on: + push: + branches: + - master + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + - uses: ammaraskar/sphinx-action@master + with: + docs-folder: "docs/" + + - uses: actions/upload-artifact@v1 + with: + name: DocumentationHTML + path: docs/_build/html/ + + # Publish built docs to gh-pages branch. + # =============================== + - name: Commit documentation changes + run: | + git clone https://github.com/bacpop/PopPUNK.git --branch gh-pages --single-branch gh-pages + cp -r docs/_build/html/* gh-pages/ + cd gh-pages + git config --local user.email "action@github.com" + 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 + # 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 }} + # =============================== \ No newline at end of file