-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #121: Improved scripts for snapshot deployment & auto-javadoc pub…
…lication. Also, openjdk7 and oraclejdk8 were removed from travis.yml to speedup builds
- Loading branch information
pablormier
committed
Aug 27, 2015
1 parent
b877615
commit 1f1ca4d
Showing
4 changed files
with
65 additions
and
87 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
This file was deleted.
Oops, something went wrong.
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,58 @@ | ||
#!/bin/bash | ||
|
||
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then | ||
echo "Skipping Javadoc publication for pull request" | ||
exit | ||
fi | ||
|
||
if [ "$TRAVIS_TAG" == "" ]; then | ||
echo "Current version is not a release, skipping Javadoc publication" | ||
exit | ||
fi | ||
|
||
echo "Auto publishing latest javadocs..." | ||
echo "TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG - TRAVIS_JDK_VERSION=$TRAVIS_JDK_VERSION - TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST" | ||
|
||
# Decide the documentation version folder name depending on the branch and the version in the pom.xml | ||
VERSION=`grep -m 1 "<hipster.version>" pom.xml | cut -d ">" -f 2 | cut -d "<" -f 1` | ||
|
||
# Validate if the version is correct (example 1.0.0-SNAPSHOT, or 1.0.0-alpha-1) | ||
VERSION_REGEX='^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9_]+(-[0-9]+)?)?$' | ||
if [[ $VERSION =~ $VERSION_REGEX ]]; then | ||
echo "Current version is $VERSION" | ||
else | ||
echo "Version error. Unrecognized version $VERSION" | ||
exit 1 | ||
fi | ||
|
||
echo "Deploying Hipster [$VERSION] javadocs to GitHub gh-pages" | ||
echo "Current directory is: `pwd`" | ||
|
||
echo "Building javadocs..." | ||
# Generate Javadocs in target/apidocs | ||
mvn javadoc:aggregate | ||
|
||
# Clone Hipster4j GitHub gh-pages for Javadocs | ||
git clone --quiet --branch=gh-pages https://github.com/citiususc/hipster.git gh-pages > /dev/null | ||
|
||
# Overwrite the previous version with the new one | ||
cp -Rf target/apidocs/* gh-pages/ | ||
|
||
# Create a new folder with the version number and copy the latest version to it | ||
mkdir gh-pages/$VERSION | ||
cp -Rf target/apidocs/* gh-pages/$VERSION/ | ||
|
||
# Now prepare for uploading the site to gh-pages | ||
cd gh-pages | ||
|
||
# Config git user and credentials | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "travis-ci" | ||
git config credential.helper "store --file=.git/credentials" | ||
echo "https://${GITHUB_TOKEN}:@github.com" > .git/credentials | ||
|
||
git add -A | ||
git commit -a -m "auto-commit $TRAVIS_BRANCH Hipster4j Javadocs v$VERSION (build $TRAVIS_BUILD_NUMBER)" | ||
git push -q origin gh-pages > /dev/null | ||
echo "Finished" | ||
|
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