aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kevi...@apache.org
Subject git commit: Script for creating tags. The workflow is as follows:
Date Thu, 16 Jan 2014 01:04:01 GMT
Updated Branches:
  refs/heads/master a49d94cca -> 9b752b39e


Script for creating tags. The workflow is as follows:

Example for tagging 0.2.0-SNAPSHOT
0. Sanity checks.
1. Create a release-0.2.x branch off master.
2. Create a single commit on that branch moving .auroraversion from 0.2.0-SNAPSHOT to 0.2.0.
3. Create a tag 0.2.0 for that commit.
4. Create a commit on master moving .auroraversion from 0.2.0-SNAPSHOT to 0.3.0-SNAPSHOT.
5. More sanity checks, then everything can be pushed, downstream artifacts can be built/published.

Testing Done:
% ./build-support/tag-release
== Updating to latest master.
Current branch master is up to date.
== Incrementing snapshot version on master.
[master b8794ae] Incrementing snapshot version from 0.2.0-SNAPSHOT to 0.3.0-SNAPSHOT.
 1 file changed, 1 insertion(+), 1 deletion(-)
== Creating release-0.2.x branch.
Switched to a new branch 'release-0.2.x'
== Committing updated .auroraversion.
[release-0.2.x b3bab21] aurora-0.2.0 release.
 1 file changed, 1 insertion(+), 1 deletion(-)
== Creating tag 0.2.0.
== Tag created.

After you've verified that everything looks good, publish the new tag by running:
  git push origin master
  git push release-0.2.x master
  git push 0.2.0 master

Reviewed at https://reviews.apache.org/r/16265/


Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/9b752b39
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/9b752b39
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/9b752b39

Branch: refs/heads/master
Commit: 9b752b39e92bd24a9d8dcb0629f5ac4394541c4b
Parents: a49d94c
Author: Kevin Sweeney <kevints@apache.org>
Authored: Wed Jan 15 17:02:58 2014 -0800
Committer: Kevin Sweeney <kevints@apache.org>
Committed: Wed Jan 15 17:03:21 2014 -0800

----------------------------------------------------------------------
 build-support/tag-release | 81 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/9b752b39/build-support/tag-release
----------------------------------------------------------------------
diff --git a/build-support/tag-release b/build-support/tag-release
new file mode 100755
index 0000000..6940d5d
--- /dev/null
+++ b/build-support/tag-release
@@ -0,0 +1,81 @@
+#!/bin/bash
+# Cuts a release tag (non -snapshot) from the current master and prints instructions for
publishing
+# it. The generated tag object is PGP-signed. Given a current master on 0.3.0-snapshot it
will
+# create a git history that looks like this:
+# master~1 (0.3.0-snapshot) ----- master (0.4.0-snapshot)
+#                            \--- release-0.4.0 (0.4.0) tag: 0.4.0 (0.4.0)
+set -o errexit
+set -o nounset
+
+if [[ -n "`git status --porcelain`" ]]; then
+  echo "!! Please run from a clean master."
+  exit 1
+elif [[ "`git rev-parse --abbrev-ref HEAD`" != master ]]; then
+  echo "!! This script must be run from master."
+  exit 1
+elif [[ "`git rev-parse --show-toplevel`" != "$PWD" ]]; then
+  echo "!! This script must be run from the root of the repository."
+  exit 1
+fi
+
+echo == Updating to latest master.
+git pull
+git fetch --tags
+
+current_version=$(cat .auroraversion | tr '[a-z]' '[A-Z]')
+if ! [[ $current_version =~ .*-SNAPSHOT ]]; then
+  echo "!! This is not a SNAPSHOT branch (.auroraversion is $current_version)."
+  exit 1
+else
+  major=`echo $current_version | cut -d. -f1`
+  minor=`echo $current_version | cut -d. -f2`
+  patch=`echo $current_version | cut -d. -f3 | cut -d- -f1`
+  new_tagged_version="$major.$minor.$patch"
+  new_snapshot_version="$major.$((minor + 1)).$patch-SNAPSHOT"
+  release_branch_name="release-$major.$minor.x"
+fi
+
+if git rev-parse $new_tagged_version >/dev/null 2>&1; then
+  echo "Tag $new_tagged_version already exists, aborting."
+  exit 1
+fi
+
+current_rev=`git rev-parse HEAD`
+function print_rollback_instructions {
+cat <<EOF
+!! Looks like something failed. That's okay, the world doesn't need to know.
+
+To roll back your local repo you might need to run:
+  git reset --hard master $current_rev
+  git tag -d $new_tagged_version
+  git branch -D $release_branch_name
+EOF
+}
+trap print_rollback_instructions EXIT
+
+echo == Incrementing snapshot version on master.
+echo $new_snapshot_version > .auroraversion
+git add .auroraversion
+git commit -m "Incrementing snapshot version from $current_version to $new_snapshot_version."
+
+echo == Creating $release_branch_name branch.
+git checkout -b $release_branch_name $current_rev
+
+echo == Committing updated .auroraversion.
+echo $new_tagged_version > .auroraversion
+git add .auroraversion
+git commit -m "aurora-$new_tagged_version release."
+
+echo == Creating tag $new_tagged_version.
+git tag -s -m "aurora-$new_tagged_version release." $new_tagged_version
+
+cat <<EOF
+== Tag created.
+
+After you've verified that everything looks good, publish the new tag by running:
+  git push origin master
+  git push $new_tagged_version master
+EOF
+trap '' EXIT # Unset error message handler.
+
+exit 0


Mime
View raw message