mirror of https://github.com/perkeep/perkeep.git
Add a make-release script.
Change-Id: I1090efd713dfb8f6ca114b6d3f3e652eeccc8493
This commit is contained in:
parent
04bd9cd897
commit
748806418c
|
@ -0,0 +1,46 @@
|
|||
#!/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
|
||||
}) {
|
||||
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";
|
Loading…
Reference in New Issue