From cb23e1003e6b78b418ea381aed20e441017b74e4 Mon Sep 17 00:00:00 2001 From: Corran Webster Date: Fri, 13 Sep 2024 11:17:52 +0100 Subject: [PATCH] A build-deploy docs step (#15) --- .github/workflows/build_docs.yaml | 34 +++++++++++++++++++++++++------ .github/workflows/check_docs.yaml | 25 +++++++++++++++++++++++ 2 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/check_docs.yaml diff --git a/.github/workflows/build_docs.yaml b/.github/workflows/build_docs.yaml index e5bfee7..22fe20d 100644 --- a/.github/workflows/build_docs.yaml +++ b/.github/workflows/build_docs.yaml @@ -1,11 +1,13 @@ -name: "Pull Request Docs Check" +name: "Build/Deploy Docs" on: -- workflow_dispatch -- pull_request + workflow_dispatch: + push: + branches: + - main jobs: - docs: + build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -18,8 +20,28 @@ jobs: - name: Build HTML documentation with Sphinx run: make html working-directory: docs - - uses: actions/upload-artifact@v4 + - uses: actions/upload-pages-artifact@v3 with: - name: documentation path: docs/build/html retention-days: 7 + + deploy: + # Add a dependency to the build job + needs: build + + # Grant GITHUB_TOKEN the permissions required to make a Pages deployment + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + + # Deploy to the github-pages environment + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + # Specify runner + deployment step + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/check_docs.yaml b/.github/workflows/check_docs.yaml new file mode 100644 index 0000000..cd2c316 --- /dev/null +++ b/.github/workflows/check_docs.yaml @@ -0,0 +1,25 @@ +name: "Pull Request Docs Check" + +on: +- workflow_dispatch +- pull_request + +jobs: + check-docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Install dependencies and local packages + run: python -m pip install sphinx pydata-sphinx-theme + - name: Build HTML documentation with Sphinx + run: make html + working-directory: docs + - uses: actions/upload-artifact@v4 + with: + name: documentation + path: docs/build/html + retention-days: 7