Skip to content

Commit 9578cdc

Browse files
authored
Merge pull request #5 from mackee/feature/release-scripts
add release scripts
2 parents 8c04f3b + 8e0d75e commit 9578cdc

File tree

6 files changed

+45
-10
lines changed

6 files changed

+45
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
.glide/
1515
vendor/
1616
_bin/
17+
_artifacts/

Makefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
VERSION := $(shell git describe --tags)
2+
3+
_bin/release-request: *.go
4+
go generate
5+
go build -o _bin/release-request -ldflags="-X main.Version=$(VERSION)"
6+
7+
.PHONY: clean install get-deps test build
8+
9+
test:
10+
go test -v -race
11+
go vet
12+
13+
get-deps:
14+
go get -u github.com/golang/dep/cmd/dep
15+
dep ensure
16+
17+
clean:
18+
rm -Rf _bin/* _artifacts/*
19+
20+
install: _bin/release-request
21+
install _bin/release-request $(GOPATH)/bin
22+
23+
build: clean get-deps test
24+
go generate
25+
gox -output "_artifacts/{{.Dir}}-{{.OS}}-{{.Arch}}-${VERSION}/release-request" -ldflags "-w -s -X main.Version=$(VERSION)"
26+
cd _artifacts/ && find . -name 'release-request*' -type d | sed 's/\.\///' | xargs -I{} zip -m -q -r {}.zip {}
27+
28+
release:
29+
ghr ${VERSION} _artifacts

_bin/.gitkeep

Whitespace-only changes.

config.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,10 @@ type Config struct {
1414
Repo Repo `yaml:"repo"`
1515
Labels []string `yaml:"labels"`
1616
TargetLabel string `yaml:"target_label"`
17-
Body struct {
18-
Markdown string `yaml:"markdown"`
19-
} `yaml:"body"`
20-
Calls []call `yaml:"calls"`
21-
Token string `yaml:"token"`
22-
Checkout bool `yaml:"checkout"`
23-
Markdown string `yaml:"markdown:`
17+
Calls []call `yaml:"calls"`
18+
Token string `yaml:"token"`
19+
Checkout bool `yaml:"checkout"`
20+
Markdown string `yaml:"markdown"`
2421
}
2522

2623
type call struct {

main.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ import (
88
"github.com/hashicorp/logutils"
99
)
1010

11+
var Version string
12+
1113
func main() {
1214
var configfile, loglevel string
13-
var isDryRun, isInit bool
15+
var isDryRun, isInit, isShowVersion bool
1416
flag.StringVar(&configfile, "config", "config.yml", "specify config file")
1517
flag.StringVar(&loglevel, "loglevel", "WARN", "log level. ex.ERROR,WARN,DEBUG")
1618
flag.BoolVar(&isDryRun, "dry-run", false, "no create/update pull request")
1719
flag.BoolVar(&isInit, "init", false, "generate sample of configuration files")
20+
flag.BoolVar(&isShowVersion, "version", false, "show this version")
1821
flag.Parse()
1922

2023
filter := &logutils.LevelFilter{
@@ -24,6 +27,11 @@ func main() {
2427
}
2528
log.SetOutput(filter)
2629

30+
if isShowVersion {
31+
log.Printf("[WARN] release-request %s", Version)
32+
return
33+
}
34+
2735
if isInit {
2836
err := GenerateTemplates(configfile)
2937
if err != nil {

template.gen.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ var Assets = assets.NewFileSystem(map[string][]string{}, map[string]*assets.File
1414
"config.yml": &assets.File{
1515
Path: "config.yml",
1616
FileMode: 0x1a4,
17-
Mtime: time.Unix(1510220397, 1510220397000000000),
17+
Mtime: time.Unix(1510225411, 1510225411000000000),
1818
Data: []byte(_Assetsf000cb359297bc9533188180f9bc040ef1fdcb3e),
1919
}, "release.md": &assets.File{
2020
Path: "release.md",
2121
FileMode: 0x1a4,
22-
Mtime: time.Unix(1510222914, 1510222914000000000),
22+
Mtime: time.Unix(1510225411, 1510225411000000000),
2323
Data: []byte(_Assets9d7da04f478156ce3962423189e531c0785612c3),
2424
}}, "")

0 commit comments

Comments
 (0)