-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added a verification script to run prior to deployment
- Loading branch information
1 parent
82168f7
commit 7818847
Showing
1 changed file
with
68 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/bash | ||
|
||
# This script runs a check that version is not "SNAPSHOT", performs a build clean, test, | ||
# package and javadoc check, aiming at pre-verifying the code is ready for deployment to maven central. | ||
# Accepts an optional flag "--skip-version|--skip-version-check that omitts the SNAPSHOT checking | ||
|
||
# Default behavior (without the flag) | ||
check_version=true | ||
|
||
# Check if the flag "--skip-version" or "--skip-version-check" is provided | ||
if [[ "$*" == *"--skip-version"* || "$*" == *"--skip-version-check"* ]]; then | ||
check_version=false # Turn of version check | ||
fi | ||
|
||
if [ "$check_version" = true ] ; then | ||
# Get the project.version from the POM | ||
PROJECT_VERSION=$(mvn -q \ | ||
-Dexec.executable=echo \ | ||
-Dexec.args='${project.version}' \ | ||
--non-recursive \ | ||
exec:exec) | ||
|
||
# Check if the "PROJECT_VERSION" ends with "SNAPSHOT" | ||
if [[ "$PROJECT_VERSION" == *SNAPSHOT ]]; then | ||
echo " | ||
============================================================================================== | ||
Error: Project version ends with 'SNAPSHOT': run 'mvn versions:set -DnewVersion={new version}' | ||
to set a valid version that can be deployed | ||
============================================================================================== | ||
" | ||
exit 1 | ||
fi | ||
else | ||
echo " | ||
!!! Version check is _NOT_ performed - please check version is not SNAPSHOT before actual deployment !!! | ||
" | ||
sleep 5 # Sleep for 5 seconds to make sure the user can see the info | ||
fi | ||
|
||
mvn clean package -P fatjar | ||
status=$? | ||
if [ $status -ne 0 ]; then | ||
echo " | ||
===================================================================================== | ||
Failed compling/testing/packaging cpsign - resolve the above issues before deployment | ||
===================================================================================== | ||
" | ||
exit $status | ||
fi | ||
|
||
# Check javadoc is OK | ||
mvn javadoc:aggregate-jar | ||
|
||
status=$? | ||
if [ $status -ne 0 ]; then | ||
echo " | ||
======================================================================" | ||
Failed generating javadoc - resolve the above issues before deployment" | ||
====================================================================== | ||
" | ||
exit $status | ||
fi |