xref: /JGit/tools/release.sh (revision 94953ac9cafe4ec632fff3510c926a78ff551e54)
1*94953ac9SMatthias Sohn#!/bin/bash
2*94953ac9SMatthias Sohn#
3*94953ac9SMatthias Sohn# script to create a jgit release
4*94953ac9SMatthias Sohn
5*94953ac9SMatthias Sohn# uncomment to switch on trace
6*94953ac9SMatthias Sohn#set -x
7*94953ac9SMatthias Sohn
8*94953ac9SMatthias Sohn# abort if a command hits an error
9*94953ac9SMatthias Sohnset -e
10*94953ac9SMatthias Sohn
11*94953ac9SMatthias Sohnexport basePath=$(cd "$(dirname "$0")"; pwd)
12*94953ac9SMatthias Sohnecho basePath $basePath
13*94953ac9SMatthias Sohn
14*94953ac9SMatthias Sohnif [ -z $1 ]; then
15*94953ac9SMatthias Sohn    echo "
16*94953ac9SMatthias Sohn    Usage:
17*94953ac9SMatthias Sohn    $ release.sh <release version tag>
18*94953ac9SMatthias Sohn
19*94953ac9SMatthias Sohn    e.g. release.sh v3.4.0.201405051725-m7
20*94953ac9SMatthias Sohn"
21*94953ac9SMatthias Sohn    exit
22*94953ac9SMatthias Sohnfi
23*94953ac9SMatthias Sohn
24*94953ac9SMatthias Sohn# trimmed git status
25*94953ac9SMatthias Sohnexport status=$(git status --porcelain)
26*94953ac9SMatthias Sohn
27*94953ac9SMatthias Sohnif [ ! -z "$status" ];
28*94953ac9SMatthias Sohnthen
29*94953ac9SMatthias Sohn    echo "
30*94953ac9SMatthias Sohn    working tree is dirty -> can't create release
31*94953ac9SMatthias Sohn"
32*94953ac9SMatthias Sohn    exit
33*94953ac9SMatthias Sohnfi
34*94953ac9SMatthias Sohn
35*94953ac9SMatthias SohnMSG="JGit $1"
36*94953ac9SMatthias Sohn
37*94953ac9SMatthias Sohn# tag release
38*94953ac9SMatthias Sohngit tag -s -m "$MSG" $1
39*94953ac9SMatthias Sohn
40*94953ac9SMatthias Sohn# update version numbers
41*94953ac9SMatthias Sohn./tools/version.sh --release
42*94953ac9SMatthias Sohn
43*94953ac9SMatthias Sohn# commit changed version numbers
44*94953ac9SMatthias Sohngit commit -a -s -m "$MSG"
45*94953ac9SMatthias Sohn
46*94953ac9SMatthias Sohn# move the tag to the version we release
47*94953ac9SMatthias Sohngit tag -sf -m "$MSG" $1
48*94953ac9SMatthias Sohn
49*94953ac9SMatthias Sohn# run the build
50*94953ac9SMatthias Sohnmvn clean install
51*94953ac9SMatthias Sohnmvn clean install -f org.eclipse.jgit.packaging/pom.xml
52*94953ac9SMatthias Sohn
53