-
Notifications
You must be signed in to change notification settings - Fork 5
109 lines (91 loc) · 3.45 KB
/
pages.yml
File metadata and controls
109 lines (91 loc) · 3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# 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 Python dependencies
run: |
pip install sphinx
pip install sphinx-rtd-theme
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- 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}
## Javadoc
# Build the aggregated Javadoc.
./mvnw --quiet clean
./mvnw --quiet -Ddoclint=none -Dinherited=false javadoc:aggregate
# Copy aggregated Javadoc into `apidocs` folder.
APIDOCS=$(pwd)/gh-pages/${DOCDIR}/apidocs
printf "Copying Javadocs from %s to %s\n" $(pwd)/target/site/apidocs ${APIDOCS}
cp -r target/site/apidocs ${APIDOCS}
## Generate examples
# Find the CLI jar and run the `examples` command.
./mvnw --quiet -Prelease -DskipTests package
jar=$(find phenopacket-tools-cli/target \
-regextype posix-extended \
-regex ".*[0-9]+\.[0-9]+\.[0-9]+(-RC[1-9][0-9]*)?(-SNAPSHOT)?\.jar$")
if [ -f "${jar}" ]; then
printf "Generating Phenopacket examples using ${jar}\n"
java -jar ${jar} examples -v --output-directory ./gh-pages/${DOCDIR}/examples
else
printf "Could not find phenopacket-tools JAR file\n"
tree -L 3 .
exit 1
fi
## 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/
# Replace the `release_tag` placeholder to the right value in place.
# This must be done *prior* generating docs in several files
sed -i "s/release_tag/${DOCDIR}/g" examples.rst
make clean html
cd ..
mv docs/_build/html/* gh-pages/${DOCDIR}
}
# We store the docs for `master` in `stable` dir
build_docs main stable
# We store the docs for `develop` in `latest` dir
build_docs develop latest
- name: Deploy documentation.
if: ${{ github.event_name == 'push' }}
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
branch: gh-pages
force: true
folder: gh-pages