mirror of https://github.com/perkeep/perkeep.git
56 lines
1.5 KiB
Perl
Executable File
56 lines
1.5 KiB
Perl
Executable File
#!/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>";
|
|
|
|
die "Not being run from root of Camlistore" unless -e ".git" && -d "pkg/blobref";
|
|
|
|
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
|
|
misc/sqlite
|
|
website
|
|
clients/chrome
|
|
lib
|
|
old
|
|
dev-appengine
|
|
dev-camget
|
|
dev-cammount
|
|
dev-camput
|
|
dev-camtool
|
|
dev-db
|
|
dev-pass-camput
|
|
dev-server
|
|
}) {
|
|
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";
|
|
|
|
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";
|