Skip to content

Commit 90cc197

Browse files
committed
fix: add javadoc publish script
Signed-off-by: Phil Adams <phil_adams@us.ibm.com>
1 parent 21d15ff commit 90cc197

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

build/publishJavadoc-gha.sh

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
# Required environment variables:
4+
# GH_TOKEN
5+
# GH_REPO_SLUG
6+
# GH_TAG
7+
8+
printf "\n>>>>> Publishing javadoc for release build: repo=%s tag=%s\n" ${GH_REPO_SLUG} ${GH_TAG}
9+
10+
printf "\n>>>>> Cloning repository's gh-pages branch into directory 'gh-pages'\n"
11+
rm -fr ./gh-pages
12+
git config --global user.email "devxsdk@us.ibm.com"
13+
git config --global user.name "ibm-devx-sdk"
14+
git clone --branch=gh-pages https://${GH_TOKEN}@github.com/IBM/platform-services-java-sdk.git gh-pages
15+
16+
printf "\n>>>>> Finished cloning...\n"
17+
18+
pushd gh-pages
19+
20+
# Create a new directory for this branch/tag and copy the javadocs there.
21+
printf "\n>>>>> Copying javadocs to new directory: docs/%s\n" ${GH_TAG}
22+
rm -rf docs/${GH_TAG}
23+
mkdir -p docs/${GH_TAG}
24+
cp -rf ../target/site/apidocs/* docs/${GH_TAG}
25+
26+
printf "\n>>>>> Generating gh-pages index.html...\n"
27+
../build/generateJavadocIndex.sh > index.html
28+
29+
printf "\n>>>>> Committing new javadoc...\n"
30+
git add -f .
31+
git commit -m "docs: latest javadoc for ${GH_TAG}"
32+
git push -f origin gh-pages
33+
34+
popd
35+
36+
printf "\n>>>>> Published javadoc for release build: repo=%s tag=%s\n" ${GH_REPO_SLUG} ${GH_TAG}
37+

0 commit comments

Comments
 (0)