Skip to content

Commit

Permalink
Fix Javadoc publishing from Azure (#936)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamCarlberg authored Apr 18, 2019
1 parent f83639a commit f7da679
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions .azure-scripts/push-javadoc-to-gh-pages.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
#!/bin/bash

# Source of file: http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/
if [ -z "${GH_TOKEN}" ] && [ "${Build_SourceBranchName}" == "master" ]
then

echo -e "Generating javadoc...\n"
./gradlew aggregateJavadocs
if [ -z ${GH_TOKEN+x} ]; then
echo "GH_TOKEN is unset, cannot publish Javadoc"
exit 0;
fi

echo -e "Publishing javadoc...\n"
echo -e "Generating javadoc...\n"
./gradlew aggregateJavadocs

cp -R build/docs/javadoc $HOME/javadoc-latest
echo -e "Publishing javadoc...\n"

cd $HOME
git config --global user.email "azuredevops@microsoft.com"
git config --global user.name "azure-pipelines"
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/WPIRoboticsProjects/grip gh-pages #> /dev/null
cp -R build/docs/javadoc $HOME/javadoc-latest

cd gh-pages
git rm -rf ./javadoc
cp -Rf $HOME/javadoc-latest ./javadoc
git add -f .
git commit -m "Lastest javadoc on successful Azure build ${Build_BuildNumber} auto-pushed to gh-pages"
git push -fq origin gh-pages #> /dev/null
cd $HOME
git config user.email "azuredevops@microsoft.com"
git config user.name "azure-pipelines"
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/WPIRoboticsProjects/grip gh-pages #> /dev/null

echo -e "Published Javadoc to gh-pages.\n"
cd gh-pages
git rm -rf ./javadoc
cp -Rf $HOME/javadoc-latest ./javadoc
git add -f .
git commit -m "Lastest javadoc on successful Azure build ${BUILD_BUILD_NUMBER} auto-pushed to gh-pages"
git push -fq origin gh-pages #> /dev/null

fi
echo -e "Published Javadoc to gh-pages.\n"

0 comments on commit f7da679

Please sign in to comment.