diff --git a/.github/actions/build_documentation/action.yml b/.github/actions/build_documentation/action.yml new file mode 100644 index 00000000..a8f5d99b --- /dev/null +++ b/.github/actions/build_documentation/action.yml @@ -0,0 +1,23 @@ +Name: Build documentation +description: Build the QUEENS documentation with sphinx + +runs: + using: composite + steps: + - uses: actions/checkout@v4 + - name: Create Python environment + id: environment + uses: ./.github/actions/create_python_environment + - name: Sphinx build + env: + PYTHON_PACKAGE_MANAGER: ${{steps.environment.outputs.ppm}} + run: | + $PYTHON_PACKAGE_MANAGER activate queens + sphinx-apidoc -o doc/source queens -f -M + cd doc + sphinx-build -b html -d build/doctrees source build/html + - name: Upload html + uses: actions/upload-pages-artifact@v3 + with: + path: doc/build/html + retention-days: 1 diff --git a/.github/workflows/build_documentation.yml b/.github/workflows/build_documentation.yml index 035df80f..7f9547a0 100644 --- a/.github/workflows/build_documentation.yml +++ b/.github/workflows/build_documentation.yml @@ -19,23 +19,8 @@ jobs: run: shell: bash -l {0} steps: - - uses: actions/checkout@v4 - - name: Create Python environment - id: environment - uses: ./.github/actions/create_python_environment - - name: Sphinx build - env: - PYTHON_PACKAGE_MANAGER: ${{steps.environment.outputs.ppm}} - run: | - $PYTHON_PACKAGE_MANAGER activate queens - sphinx-apidoc -o doc/source queens -f -M - cd doc - sphinx-build -b html -d build/doctrees source build/html - - name: Upload html - uses: actions/upload-pages-artifact@v3 - with: - path: doc/build/html - retention-days: 1 + - name: Build documentation + uses: ./.github/actions/build_documentation deploy-documentation: needs: build-documentation diff --git a/.github/workflows/preview_documentation.yml b/.github/workflows/preview_documentation.yml new file mode 100644 index 00000000..d8812515 --- /dev/null +++ b/.github/workflows/preview_documentation.yml @@ -0,0 +1,39 @@ +# yamllint disable +name: build_documentation + +on: + pull_request: + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: preview-${{ github.ref }} + +jobs: + build-documentation: + runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} + steps: + - name: Build documentation + uses: ./.github/actions/build_documentation + + deploy-preview: + needs: build-documentation + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - Name: Deploy preview + uses: rossjrw/pr-preview-action@v1 + with: + source-dir: build + deploy-repository: queens-doc-preview + preview-branch: gh-pages + umbrella-dir: docs/pr-preview + pages-base-path: docs + action: auto