-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Simple workflow for deploying static content to GitHub Pages | ||
name: Deploy documentation to GitHub Pages | ||
|
||
on: | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
# Runs on pushes targeting the main branch | ||
push: | ||
branches: [ main, develop ] | ||
|
||
jobs: | ||
build-docs: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo | ||
ref: main | ||
|
||
- name: Set up Python 3 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Install library with docs dependencies | ||
run: | | ||
python3 -m pip install .[docs] | ||
- name: Generate examples and build documentation | ||
run: | | ||
## Init the target folder. | ||
# We will put all site documentation there. | ||
mkdir -p gh-pages | ||
touch gh-pages/.nojekyll | ||
function build_docs { | ||
# The function will checkout a branch and build the Javadoc & documentation | ||
# into provided documentation directory. | ||
BRANCH=${1} | ||
DOCDIR=${2} | ||
git checkout ${BRANCH} | ||
git fetch | ||
git pull | ||
## Init the target folder. | ||
# We will put all site documentation there. | ||
mkdir -p gh-pages/${DOCDIR} | ||
## Build the docs | ||
# Generate the HTML pages and move the generated content into the target folder. | ||
printf "Building the %s documentation\n" ${DOCDIR} | ||
cd docs | ||
sphinx-apidoc --separate --module-first -d 2 -H "API reference" --follow-links -o apidocs ../src/genophenocorr | ||
# TODO - enable doctest when ready | ||
make html | ||
mv _build/html/* ../gh-pages/${DOCDIR} | ||
cd .. | ||
} | ||
# We store the docs for `main` in `stable` dir | ||
# TODO - enable when the docs make it into `main` | ||
#build_docs main stable | ||
# We store the docs for `development` in `latest` dir | ||
build_docs develop latest | ||
- name: Deploy documentation | ||
if: ${{ github.event_name == 'push' }} | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
force: true | ||
folder: gh-pages |