2013-06-11 10:36:41 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use Getopt::Long;
|
|
|
|
my $opt_force;
|
|
|
|
GetOptions("force" => \$opt_force) or die "Usage: make-release [-f] <version>";
|
|
|
|
|
|
|
|
my $version = shift or die "Usage: make-release <version>";
|
|
|
|
|
2018-01-30 11:02:56 +00:00
|
|
|
die "Not being run from root of Perkeep" unless -e ".git" && -e "pkg/blob/ref.go";
|
2013-06-11 10:36:41 +00:00
|
|
|
|
|
|
|
my $cur_branch = `git rev-parse --abbrev-ref HEAD`;
|
|
|
|
chomp $cur_branch;
|
|
|
|
die "Not on master" unless $cur_branch eq "master";
|
|
|
|
|
|
|
|
my $new_branch = "releases/$version";
|
|
|
|
|
|
|
|
if ($opt_force) {
|
|
|
|
system("git", "tag", "-d", $version);
|
|
|
|
system("git", "branch", "-D", $new_branch);
|
|
|
|
}
|
|
|
|
|
|
|
|
system("git", "checkout", "-b", $new_branch) and die "Failed to create branch $new_branch from master. Does it already exist?";
|
|
|
|
|
|
|
|
open(my $fh, ">VERSION") or die;
|
|
|
|
print $fh "$version\n";
|
|
|
|
close($fh);
|
|
|
|
|
|
|
|
system("git", "add", "VERSION") and die;
|
2014-02-28 06:03:52 +00:00
|
|
|
system("git", "commit", "-m", "Add VERSION file on the $new_branch branch.") and die "Failed to commit";
|
2013-06-11 10:36:41 +00:00
|
|
|
system("git", "tag", $version) and die "Failed to tag";
|
|
|
|
|
2013-06-11 13:05:42 +00:00
|
|
|
my $commit = do { open(my $f, ".git/refs/tags/$version") or die; local $/; <$f> };
|
|
|
|
chomp $commit;
|
|
|
|
|
|
|
|
system("git", "checkout", "master") and die;
|
|
|
|
open(my $fh, ">>misc/release-history-tags");
|
|
|
|
print $fh "$commit\t$version\n";
|
|
|
|
close($fh);
|
|
|
|
|
2013-06-11 10:36:41 +00:00
|
|
|
print "Created branch $new_branch from master, cleaned it and wrote VERSION file, & tagged $version.\n";
|
|
|
|
print "\n";
|
|
|
|
print "Push with:\n";
|
|
|
|
print "\$ git push github refs/tags/$version:refs/tags/$version\n";
|
|
|
|
print "\$ git push github $new_branch:$new_branch\n";
|