diff --git a/Taskfile.yml b/Taskfile.yml index acd30038..1a54c8f6 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -3,7 +3,9 @@ install: desc: Installs Task cmds: - - go install -v ./... + - go install -v -ldflags="-w -s -X main.version={{.GIT_COMMIT}}" ./cmd/task + vars: + GIT_COMMIT: $git log -n 1 --format=%h dl-deps: desc: Downloads cli dependencies @@ -17,6 +19,11 @@ update-deps: - dep ensure - dep prune +clean: + desc: Cleans temp files and folders + cmds: + - rm -rf dist/ + lint: desc: Runs golint cmds: @@ -35,3 +42,8 @@ release: desc: Release Task cmds: - goreleaser + +test-release: + desc: Tests release process without publishing + cmds: + - goreleaser --skip-validate --skip-publish diff --git a/cmd/task/task.go b/cmd/task/task.go index cb0f58f6..4abafb0f 100644 --- a/cmd/task/task.go +++ b/cmd/task/task.go @@ -9,6 +9,10 @@ import ( "github.com/spf13/pflag" ) +var ( + version = "master" +) + func main() { log.SetFlags(0) @@ -30,16 +34,23 @@ hello: } var ( - init bool - force bool - watch bool + versionFlag bool + init bool + force bool + watch bool ) + pflag.BoolVar(&versionFlag, "version", false, "show Task version") pflag.BoolVarP(&init, "init", "i", false, "creates a new Taskfile.yml in the current folder") pflag.BoolVarP(&force, "force", "f", false, "forces execution even when the task is up-to-date") pflag.BoolVarP(&watch, "watch", "w", false, "enables watch of the given task") pflag.Parse() + if versionFlag { + log.Printf("Task version: %s\n", version) + return + } + if init { if err := task.InitTaskfile(); err != nil { log.Fatal(err) diff --git a/goreleaser.yml b/goreleaser.yml index c8ca42b7..4c243d5e 100644 --- a/goreleaser.yml +++ b/goreleaser.yml @@ -8,3 +8,16 @@ build: goarch: - 386 - amd64 + ignore: + - goos: darwin + goarch: 386 + +archive: + format_overrides: + - goos: windows + format: zip + + replacements: + amd64: x64 + 386: x86 + darwin: macOS