Skip to content

Commit

Permalink
docs: add worklow to preview documentation on PR
Browse files Browse the repository at this point in the history
  • Loading branch information
leahaeusel committed Jan 15, 2025
1 parent b3eb040 commit d42111a
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 17 deletions.
23 changes: 23 additions & 0 deletions .github/actions/build_documentation/action.yml
Original file line number Diff line number Diff line change
@@ -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
19 changes: 2 additions & 17 deletions .github/workflows/build_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/preview_documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# yamllint disable
name: preview_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: Checkout
uses: actions/checkout@v4
- 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

0 comments on commit d42111a

Please sign in to comment.