Skip to content

Commit 685b9ae

Browse files
committed
improvements on release process
1 parent e97fd65 commit 685b9ae

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed

Taskfile.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
install:
44
desc: Installs Task
55
cmds:
6-
- go install -v ./...
6+
- go install -v -ldflags="-w -s -X main.version={{.GIT_COMMIT}}" ./cmd/task
7+
vars:
8+
GIT_COMMIT: $git log -n 1 --format=%h
79

810
dl-deps:
911
desc: Downloads cli dependencies
@@ -17,6 +19,11 @@ update-deps:
1719
- dep ensure
1820
- dep prune
1921

22+
clean:
23+
desc: Cleans temp files and folders
24+
cmds:
25+
- rm -rf dist/
26+
2027
lint:
2128
desc: Runs golint
2229
cmds:
@@ -35,3 +42,8 @@ release:
3542
desc: Release Task
3643
cmds:
3744
- goreleaser
45+
46+
test-release:
47+
desc: Tests release process without publishing
48+
cmds:
49+
- goreleaser --skip-validate --skip-publish

cmd/task/task.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import (
99
"github.com/spf13/pflag"
1010
)
1111

12+
var (
13+
version = "master"
14+
)
15+
1216
func main() {
1317
log.SetFlags(0)
1418

@@ -30,16 +34,23 @@ hello:
3034
}
3135

3236
var (
33-
init bool
34-
force bool
35-
watch bool
37+
versionFlag bool
38+
init bool
39+
force bool
40+
watch bool
3641
)
3742

43+
pflag.BoolVar(&versionFlag, "version", false, "show Task version")
3844
pflag.BoolVarP(&init, "init", "i", false, "creates a new Taskfile.yml in the current folder")
3945
pflag.BoolVarP(&force, "force", "f", false, "forces execution even when the task is up-to-date")
4046
pflag.BoolVarP(&watch, "watch", "w", false, "enables watch of the given task")
4147
pflag.Parse()
4248

49+
if versionFlag {
50+
log.Printf("Task version: %s\n", version)
51+
return
52+
}
53+
4354
if init {
4455
if err := task.InitTaskfile(); err != nil {
4556
log.Fatal(err)

goreleaser.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,16 @@ build:
88
goarch:
99
- 386
1010
- amd64
11+
ignore:
12+
- goos: darwin
13+
goarch: 386
14+
15+
archive:
16+
format_overrides:
17+
- goos: windows
18+
format: zip
19+
20+
replacements:
21+
amd64: x64
22+
386: x86
23+
darwin: macOS

0 commit comments

Comments
 (0)