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>";
|
|
|
|
|
2013-08-26 23:05:12 +00:00
|
|
|
die "Not being run from root of Camlistore" 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;
|
|
|
|
foreach my $d (qw{
|
|
|
|
.hackfests
|
|
|
|
website
|
|
|
|
clients/chrome
|
|
|
|
lib
|
2013-06-11 11:14:05 +00:00
|
|
|
old
|
|
|
|
dev-cammount
|
|
|
|
dev-camtool
|
|
|
|
dev-db
|
2013-06-11 10:36:41 +00:00
|
|
|
}) {
|
|
|
|
system("git", "rm", "-r", $d) and die "Failed to git rm -r $d";
|
|
|
|
}
|
|
|
|
system("git", "commit", "-m", "Add VERSION file and clean tree for release $version") and die "Failed to commit";
|
|
|
|
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";
|