Skip to content

Commit

Permalink
fix: fix javadoc/gh-pages issues (#200)
Browse files Browse the repository at this point in the history
Signed-off-by: Phil Adams <phil_adams@us.ibm.com>
  • Loading branch information
padamstx authored Jul 19, 2023
1 parent 240e319 commit 9b26bda
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
7 changes: 4 additions & 3 deletions build/generateJavadocIndex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ echo '<!DOCTYPE html>
| <a href="https://github.com/IBM/platform-services-java-sdk">GitHub</a>
</p>
<p>Javadoc by branch/release:</p>
<ul><li><a href="docs/latest">Latest</a></li>'
ls docs | grep --invert-match index.html | sed 's/^.*/<li><a href="docs\/&">&<\/a><\/li>/'
<p>Javadoc by release:</p>
<ul>'
echo ${TRAVIS_BRANCH} | sed 's/^.*/ <li><a href="docs\/&">Latest release<\/a><\/li>/'
ls docs | grep --invert-match index.html | sed 's/^.*/ <li><a href="docs\/&">&<\/a><\/li>/'
echo ' </ul>
</div>
</body>
Expand Down
21 changes: 5 additions & 16 deletions build/publishJavadoc.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# Avoid publishing javadocs for a PR build
if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" ]; then
# Publish javadocs only for a tagged-release.
if [[ -n "${TRAVIS_TAG}" ]]; then

printf "\n>>>>> Publishing javadoc for release build: repo=%s branch=%s build_num=%s job_num=%s\n" ${TRAVIS_REPO_SLUG} ${TRAVIS_BRANCH} ${TRAVIS_BUILD_NUMBER} ${TRAVIS_JOB_NUMBER}

Expand All @@ -11,31 +11,20 @@ if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" ]; then

printf "\n>>>>> Finished cloning...\n"


pushd gh-pages

# Create a new directory for this branch/tag and copy the aggregated javadocs there.
printf "\n>>>>> Copying aggregated javadocs to new tagged-release directory: %s\n" ${TRAVIS_BRANCH}
# Create a new directory for this branch/tag and copy the javadocs there.
printf "\n>>>>> Copying javadocs to new directory: docs/%s\n" ${TRAVIS_BRANCH}
rm -rf docs/${TRAVIS_BRANCH}
mkdir -p docs/${TRAVIS_BRANCH}
cp -rf ../target/site/apidocs/* docs/${TRAVIS_BRANCH}

printf "\n>>>>> Generating gh-pages index.html...\n"
../build/generateJavadocIndex.sh > index.html

# Update the 'latest' symlink to point to this branch if it's a tagged release.
if [ -n "$TRAVIS_TAG" ]; then
pushd docs
rm latest
ln -s ./${TRAVIS_TAG} latest
printf "\n>>>>> Updated 'docs/latest' symlink:\n"
ls -l latest
popd
fi

printf "\n>>>>> Committing new javadoc...\n"
git add -f .
git commit -m "Javadoc for release ${TRAVIS_TAG} (${TRAVIS_COMMIT})"
git commit -m "docs: latest javadoc for ${TRAVIS_BRANCH} (${TRAVIS_COMMIT})"
git push -f origin gh-pages

popd
Expand Down

0 comments on commit 9b26bda

Please sign in to comment.