Skip to content

Commit

Permalink
Add release build script
Browse files Browse the repository at this point in the history
  • Loading branch information
tardisx committed Jun 24, 2019
1 parent 0548db2 commit ff4ebae
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions build-release.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env perl

use strict;
use warnings;

open my $fh, "<", "main.go" || die $!;

my $version;
while (<$fh>) {
$version = $1 if /^const\s+currentVersion.*?"([\d\.]+)"/;
}
close $fh;

die "no version?" unless defined $version;

# so lazy
system "rm", "-rf", "release", "dist";
system "mkdir", "release";
system "mkdir", "dist";

my %build = (
win => { env => { GOOS => 'windows', GOARCH => '386' }, filename => 'slicerdicer.exe' },
linux => { env => { GOOS => 'linux', GOARCH => '386' }, filename => 'slicerdicer' },
mac => { env => { GOOS => 'darwin', GOARCH => '386' }, filename => 'slicerdicer' },
);

foreach my $type (keys %build) {
mkdir "release/$type";
}

foreach my $type (keys %build) {
local $ENV{GOOS} = $build{$type}->{env}->{GOOS};
local $ENV{GOARCH} = $build{$type}->{env}->{GOARCH};
system "go", "build", "-o", "release/$type/" . $build{$type}->{filename};
system "zip", "-j", "dist/slicerdicer-$type-$version.zip", ( glob "release/$type/*" );
}

0 comments on commit ff4ebae

Please sign in to comment.