Add simple versioning and release building
This commit is contained in:
parent
5e760ad284
commit
a8028938a0
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1,3 @@
|
|||||||
gropple
|
gropple
|
||||||
|
dist
|
||||||
|
release
|
||||||
|
39
build_release.pl
Executable file
39
build_release.pl
Executable file
@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
open my $fh, "<", "main.go" || die $!;
|
||||||
|
|
||||||
|
my $version;
|
||||||
|
while (<$fh>) {
|
||||||
|
$version = $1 if /^const\s+currentVersion.*?"(v[\d\.]+)"/;
|
||||||
|
}
|
||||||
|
close $fh;
|
||||||
|
|
||||||
|
die "no version?" unless defined $version;
|
||||||
|
|
||||||
|
# quit if tests fail
|
||||||
|
system("go test ./...") && die "not building release with failing tests";
|
||||||
|
|
||||||
|
# so lazy
|
||||||
|
system "rm", "-rf", "release", "dist";
|
||||||
|
system "mkdir", "release";
|
||||||
|
system "mkdir", "dist";
|
||||||
|
|
||||||
|
my %build = (
|
||||||
|
win => { env => { GOOS => 'windows', GOARCH => 'amd64' }, filename => 'gropple.exe' },
|
||||||
|
linux => { env => { GOOS => 'linux', GOARCH => 'amd64' }, filename => 'gropple' },
|
||||||
|
mac => { env => { GOOS => 'darwin', GOARCH => 'amd64' }, filename => 'gropple' },
|
||||||
|
);
|
||||||
|
|
||||||
|
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/gropple-$type-$version.zip", ( glob "release/$type/*" );
|
||||||
|
}
|
4
main.go
4
main.go
@ -39,6 +39,8 @@ var downloadPath = "./"
|
|||||||
|
|
||||||
var address string
|
var address string
|
||||||
|
|
||||||
|
const currentVersion = "v0.01"
|
||||||
|
|
||||||
//go:embed web
|
//go:embed web
|
||||||
var webFS embed.FS
|
var webFS embed.FS
|
||||||
|
|
||||||
@ -64,7 +66,7 @@ func main() {
|
|||||||
ReadTimeout: 5 * time.Second,
|
ReadTimeout: 5 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Print("starting web service")
|
log.Printf("starting gropple %s - https://github.com/tardisx/gropple", currentVersion)
|
||||||
log.Printf("go to %s for details on installing the bookmarklet and to check status", address)
|
log.Printf("go to %s for details on installing the bookmarklet and to check status", address)
|
||||||
log.Fatal(srv.ListenAndServe())
|
log.Fatal(srv.ListenAndServe())
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user