]> mj.ucw.cz Git - libucw.git/blob - debian/tag-release
Merge branch 'master' into dev-opt
[libucw.git] / debian / tag-release
1 #!/usr/bin/perl -w
2 use strict;
3
4 my $help = $ARGV[0];
5 if (defined($help) && $help eq "--help") {
6   print <<EOF;
7 Usage: $0 [-n] [version]
8 Tag this version of libucw as <version>.
9
10 If no <version> is given, a version number is computed by incrementing the last
11 number in the sequence, e.g. after 5.0 goes 5.1, etc.
12
13 Options:
14 -n  show the version, do not create any tags
15
16 EOF
17   exit 0;
18 }
19
20 my $dry = $ARGV[0];
21 if (defined($dry) && $dry eq "-n") {
22   shift @ARGV;
23 } else {
24   undef $dry;
25 }
26
27 my $vv = $ARGV[0];
28
29 my $v = `git describe`;
30 chomp $v;
31 $v =~ s/^v// or die;
32 $v =~ s/-.*//;
33 print "Old version: $v\n";
34
35 unless ($vv) {
36   my @c = split /\./, $v;
37   if (@c == 2) { push @c, 1; } else { $c[$#c]++; }
38   $vv = join(".", @c);
39 }
40
41 print "New version: $vv\n";
42 print "Not tagging, running with -n.\n" and exit 0 if $dry;
43 `git tag -a -m "Releasing version $vv" v$vv`;
44 die if $?;
45 print "Tagged. Do not forget to push with tags.\n";