added changelog to release as optional flag

- rewrote the flags to contain multiple
- added -c as changelog option
This commit is contained in:
David Hartmann 2014-06-23 03:50:09 +02:00 committed by David Hartmann
parent d437418b3c
commit 292586d96f
3 changed files with 53 additions and 12 deletions

View file

@ -9,12 +9,26 @@ hook() {
}
if test $# -gt 0; then
version=$1
shift #remove version from arguments list
remote=''
hook pre-release
echo "... releasing $1"
git commit -a -m "Release $1"
git tag $1 -a -m "Release $1" \
&& git push $2 \
&& git push $2 --tags \
echo "... releasing $version"
# check for flags
while test $# != 0
do
case "$1" in
-c) git-changelog -t "$version" ;;
-r) remote=$2; shift ;;
--) shift; break;;
*) usage ;;
esac
shift
done
git commit -a -m "Release $version"
git tag $version -a -m "Release $version" \
&& git push $remote \
&& git push $remote --tags \
&& hook post-release \
&& echo "... complete"
else

View file

@ -7,10 +7,11 @@
\fBgit\-release\fR \- Commit, tag and push changes to the repository
.
.SH "SYNOPSIS"
\fBgit\-release\fR <tagname> [<remote>]
\fBgit\-release\fR <tagname> [-c] [-r <remote>]
.
.SH "DESCRIPTION"
Commits changes with message "Release <tagname>", tags with the given <tagname> and pushes the branch / tags\.
Commits changes with message "Release <tagname>", tags with the given <tagname> and pushes the branch / tags\.
Optionally it generates a changelog (see git-changelog) and a remote can be defined\. The order of first -c or -r does not matter\.
.
.SH "OPTIONS"
<tagname>
@ -19,7 +20,13 @@ Commits changes with message "Release <tagname>", tags with the given <tagname>
The name of the newly created tag\. Also used in tag comment\.
.
.P
<remote>
-c
.
.P
Generates or populates the changelog with all commit message since the last tag. For more info see git-changelog.\.
.
.P
-r <remote>
.
.P
The "remote" repository that is destination of a push operation: it is passed to git push\.
@ -33,10 +40,16 @@ Release commit with the given <tagname>\.
$ git release 0\.1\.0
.
.IP "\(bu" 4
Release commit with the given <tagname> and populate changelog\.
.
.IP
$ git release 0\.1\.0 -c
.
.IP "\(bu" 4
Release commit with the given <tagname> and push to specific remote\.
.
.IP
$ git release 0\.1\.0 github
$ git release 0\.1\.0 -r github
.
.IP "" 0
.

View file

@ -3,11 +3,12 @@ git-release(1) -- Commit, tag and push changes to the repository
## SYNOPSIS
`git-release` &lt;tagname&gt; [&lt;remote&gt;]
`git-release` &lt;tagname&gt; [-r &lt;remote&gt;] [-c]
## DESCRIPTION
Commits changes with message "Release &lt;tagname&gt;", tags with the given &lt;tagname&gt; and pushes the branch / tags.
Optionally it generates a changelog (see git-changelog) and a remote can be defined. The order of first -c or -r does not matter.
## OPTIONS
@ -15,9 +16,13 @@ git-release(1) -- Commit, tag and push changes to the repository
The name of the newly created tag. Also used in tag comment.
&lt;remote&gt;
-r &lt;remote&gt;
The "remote" repository that is destination of a push operation: it is passed to git push.
-c
Generates or populates the changelog with all commit message since the last tag. For more info see git-changelog..
## EXAMPLES
@ -27,11 +32,20 @@ git-release(1) -- Commit, tag and push changes to the repository
* Release commit with the given &lt;tagname&gt; and push to specific remote.
$ git release 0.1.0 github
$ git release 0.1.0 -r github
* Release commit with the given &lt;tagname&gt; and populate changelog.
$ git release 0.1.0 -c
* Release commit with the given &lt;tagname&gt;, populate changelog, and push to specific remote.
$ git release 0.1.0 -r github -c
## AUTHOR
Written by Tj Holowaychuk &lt;<tj@vision-media.ca>&gt;
Extended by David Hartmann &lt;<dh@tsl.io>&gt;
## REPORTING BUGS