You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2018/09/14 08:49:25 UTC

[camel-k] 03/05: Add command to increment version

This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 5efc8a94cb7a5af3565c9bbfddd64e2fd6cf2b3b
Author: nferraro <ni...@gmail.com>
AuthorDate: Fri Sep 14 10:01:07 2018 +0200

    Add command to increment version
---
 build/Makefile           |  5 ++++-
 build/next_snapshot.sh   | 15 +++++++++++++++
 build/prepare_release.sh | 13 +++----------
 build/set_version.sh     | 19 +++++++++++++++++++
 4 files changed, 41 insertions(+), 11 deletions(-)

diff --git a/build/Makefile b/build/Makefile
index fde80b2..989cbdd 100644
--- a/build/Makefile
+++ b/build/Makefile
@@ -17,6 +17,9 @@ release: prepare-release build images-build images-push test-integration cross-c
 prepare-release:
 	./build/prepare_release.sh
 
+new-version:
+	./build/next_snapshot.sh
+
 cross-compile:
 	./build/cross_compile.sh
 
@@ -57,4 +60,4 @@ check-integration:
 
 
 
-.PHONY: build build-operator build-kamel build-embed-resources build-runtime dep codegen images images-build images-push test check test-integration check-integration clean release prepare-release cross-compile
+.PHONY: build build-operator build-kamel build-embed-resources build-runtime dep codegen images images-build images-push test check test-integration check-integration clean release prepare-release cross-compile new-version git-tag
diff --git a/build/next_snapshot.sh b/build/next_snapshot.sh
new file mode 100755
index 0000000..60b79f8
--- /dev/null
+++ b/build/next_snapshot.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -e
+
+location=$(dirname $0)
+global_version_file=$location/../version/version.go
+
+version=$($location/get_version.sh)
+version_num=$(echo $version | sed -E "s/([0-9.]*)-SNAPSHOT/\1/g")
+next_version_num=$(echo $version_num | awk 'BEGIN { FS = "." } ; {print $1"."$2"."++$3}')
+next_version="$next_version_num-SNAPSHOT"
+
+echo "Increasing version to $next_version"
+
+$location/set_version.sh $next_version
diff --git a/build/prepare_release.sh b/build/prepare_release.sh
index b9d5881..6357682 100755
--- a/build/prepare_release.sh
+++ b/build/prepare_release.sh
@@ -3,17 +3,10 @@
 set -e
 
 location=$(dirname $0)
-global_version_file=$location/../version/version.go
 
-# Set the new global version by removing "-SNAPSHOT"
-sed -i "s/-SNAPSHOT//g" $global_version_file
-find $location/../deploy -type f -exec sed -i "s/-SNAPSHOT//g" {} \;
-
-# Get the new version
 version=$($location/get_version.sh)
+version_num=$(echo $version | sed -E "s/([0-9.]*)-SNAPSHOT/\1/g")
 
-# Updating the Java modules
-mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$version -f $location/../runtime
-
-echo "Camel K prepared for releasing version: $version"
+$location/set_version.sh $version_num
 
+echo "Camel K prepared for releasing version: $version_num"
diff --git a/build/set_version.sh b/build/set_version.sh
new file mode 100755
index 0000000..9f0da58
--- /dev/null
+++ b/build/set_version.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -e
+
+location=$(dirname $0)
+new_version=$1
+
+global_version_file=$location/../version/version.go
+version=$($location/get_version.sh)
+
+# Set the new global version
+sed -i "s/$version/$new_version/g" $global_version_file
+find $location/../deploy -type f -exec sed -i "s/$version/$new_version/g" {} \;
+
+# Updating the Java modules
+mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$new_version -f $location/../runtime
+
+echo "Camel K version set to: $new_version"
+