02b04a598092c77a8ef914b91eef010b05961bc8
[feisty_meow.git] / scripts / rev_control / quick_git_release.sh
1 #!/bin/bash
2
3 # a simple and quick method for making a new release, merging it into the master branch,
4 # and tagging it with a new tag for the release.
5 # currently needs to be told the new release name, which is actually also gotten from
6 # the "next_version" script.  if these differ, there will be confusion for users about
7 # the right version number.  for now, look at the config file in production to get
8 # the current version, add one to the revision number, and pass major.minor.revision to
9 # this release script.
10
11 source $FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh
12
13 #hmmm: fixes--
14 #  done + need to make the version a parameter passed to here, and complain if it's not provided.
15 #  + better if we could get the version automatically, but there is a circular dependency where we want to check out the new branch by version number.
16
17 # these are the steps i take on feisty meow when i have a dev branch that is
18 # ready to merge in to the master branch as a new release.  the process
19 # includes adding the tag for the new release and such.  there are manual
20 # steps for adding the commit comments, including an introspection phase
21 # with gitk before the release commit comment is created.
22 function make_new_feisty_meow_release()
23 {
24   # snag the version number from the passed parameter.
25   local new_version="$1"; shift
26   local scriptname="$(basename $0 .sh)"
27
28   if [ -z "$new_version" ]; then
29     echo "\
30 $scriptname: this script requires a version number to use for the
31 branch name and release tag name of the new release.
32 "
33     return 1
34   fi
35
36   # jump into the top of the feisty meow codebase.
37   pushd $FEISTY_MEOW_APEX
38   # make up a release name based on the version number.
39   local new_release="release-${new_version}"
40   # make a new branch for the release based on the dev branch.
41 echo about to git checkout
42 read line
43   git checkout -b $new_release dev
44   exit_on_error checking out a new branch called $new_release
45   # bump feisty meow version. 
46   bash ./scripts/generator/next_version.sh
47   exit_on_error bumping version for feisty meow codebase
48 echo about to commit
49 read line
50   # check in the changes in the new release branch, which now includes a revised version.
51   git commit -a
52   exit_on_error committing all changes
53 echo about to check out master
54 read line
55   # grab out the master branch as the active one.
56   git checkout master
57   exit_on_error checking out master branch
58 echo about to merge
59 read line
60   # merge the master branch with the new release.
61   git merge --no-ff $new_release
62   exit_on_error merging in the new release in master
63   # let the committer see the most recent changes.
64   echo "=> launching gitk to show you the full set of changes;"
65   echo "=> please prepare a kick-ass commit comment."
66   gitk
67   exit_on_error launching gitk
68   # now make a tag for the new release, which is where we should go crazy with the detailed
69   # and useful comments for what has changed in this release, gathered from the gitk that
70   # we just launched.  this should include all of the work on the development branch since
71   # the last release...
72 echo about to TAG
73 read line
74   git tag -a $new_version
75   exit_on_error tagging new version as $new_version
76 echo about to commit master branch with all those changes
77 read line
78   # commit the full set of changes for the master branch now, including the tags.
79   rcheckin .
80   exit_on_error checking in the changes in master branch
81 echo switching to dev branch
82 read line
83   # switch back to the dev branch.
84   git checkout dev
85   exit_on_error checking the dev branch out again
86 echo merging in from master
87 read line
88   # merge in the latest changes from master, which should only be the revised version really.
89   git merge --no-ff $new_release
90   exit_on_error merging the release changes into the dev branch
91   # back to where we started.
92   popd
93 }
94
95
96 make_new_feisty_meow_release "$1"
97
98