feat(release): Added '--no-maven-release' and '--daily-timestamp-version'
@@ -17,7 +17,8 @@ release::usage() {
cat - <<EOT
-n --dry-run Dry run, which performs the whole build but does no tagging, artefact
upload or pushing Docker images
- --release-version <ver> Version to release (e.g. "1.2.1"). This is a mandatory argument.
+ --release-version <ver> Version to release (e.g. "1.2.1"). One version arg is mandatory
+ --daily-timestamp-version Calculate a daily timestamp version automatically
--dev-version <version> Next development version. If not given, set to "<major>.<minor>-SNAPSHOT"
as calculated from --release-version (e.g. "1.2-SNAPSHOT")
--settings <file> Path to a custom settings.xml to use for the release.
@@ -47,9 +48,14 @@ release::run() {
# Validate release versions. Release versions have the foramt "1.3.4"
local release_version=$(readopt --release-version)
if [ -z "${release_version}" ]; then
+ if [ $(hasflag --daily-timestamp-version) ]; then
+ release_version="$(calc_timestamp_version "$topdir")"
+ check_error $release_version
+ else
echo "Please specify --release-version"
exit 1
fi
+ fi
# Get the Syndesis minor version (e.g. "1.3")
local syndesis_tag=$(extract_minor_version $release_version)
@@ -155,6 +161,14 @@ create_templates_for_minor_version() {
# ===================================================================================================
# Prep actions:
+calc_timestamp_version() {
+ local topdir=$1
+ cd $topdir/app
+ local pom_version=$(mvn -N help:evaluate -Dexpression="project.version" | grep -v '\[' | sed -e 's/\([0-9]*\.[0-9]*\).*/\1/')
+ local patch_level=$(git tag | grep ^$pom_version | sed -e s/${pom_version}.// | sort -n -r | head -1)
+ echo "${pom_version}.$((patch_level+1))-$(date '+%Y%m%d')"
+}
+
check_git_clean() {
local topdir=$1
@@ -204,7 +218,7 @@ stage_artefacts() {
local maven_opts="$2"
if [ $(hasflag --no-maven-release) ]; then
- echo "==== [Skipping Maven staging to Sonatype (--no-maven-release)]"
+ echo "==== Skipping Maven staging to Sonatype (--no-maven-release)"
return
fi
@@ -244,10 +258,9 @@ create_upgrade_docker_image() {
cp $topdir/install/syndesis.yml .
# Create the image
- docker build -t syndesis/syndesis-upgrade:${tag} --build-arg version=${release_version} .
+ docker build -t syndesis/syndesis-upgrade:${release_version} --build-arg version=${release_version} .
}
-
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Commit, push, release actions
