Skip to content

Commit 7de781f

Browse files
wdstartk3fftk
authored andcommitted
feat(19): add goreleaser configurations. (#25)
1 parent 927be95 commit 7de781f

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*.dll
55
*.so
66
*.dylib
7+
dist/
78

89
# Test binary, build with `go test -c`
910
*.test

.goreleaser.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Make sure to check the documentation at http://goreleaser.com
2+
before:
3+
hooks:
4+
# you may remove this if you don't use vgo
5+
- go mod download
6+
# you may remove this if you don't need go generate
7+
#- go generate ./...
8+
builds:
9+
- env:
10+
- GO111MODULE=on
11+
- CGO_ENABLED=0
12+
goos:
13+
- windows
14+
- darwin
15+
- linux
16+
goarch:
17+
- amd64
18+
#- 386
19+
ldflags:
20+
- -s -w
21+
-X github.com/tk3fftk/sdctl/command.version={{.Version}}
22+
-X github.com/tk3fftk/sdctl/command.commit={{.Commit}}
23+
-X github.com/tk3fftk/sdctl/command.date={{.Date}}
24+
-X github.com/tk3fftk/sdctl/command.builtBy=goreleaser
25+
archives:
26+
- replacements:
27+
darwin: Darwin
28+
linux: Linux
29+
windows: Windows
30+
386: i386
31+
amd64: x86_64
32+
checksum:
33+
name_template: 'checksums.txt'
34+
snapshot:
35+
name_template: "{{ .Tag }}-next"
36+
changelog:
37+
sort: asc
38+
filters:
39+
exclude:
40+
- '^docs:'
41+
- '^test:'

command/cmd.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
package command
22

33
import (
4+
"fmt"
5+
46
"github.com/spf13/cobra"
57
"github.com/tk3fftk/sdctl/pkg/sdapi"
68
"github.com/tk3fftk/sdctl/pkg/sdctl_context"
79
)
810

11+
var (
12+
version = "dev"
13+
commit = "none"
14+
date = "unknown"
15+
builtBy = "unknown"
16+
)
17+
918
func NewCmd(config sdctl_context.SdctlConfig, api sdapi.SDAPI) *cobra.Command {
1019
cmd := &cobra.Command{
1120
Use: "sdctl",
1221
Short: "Screwdriver.cd API wrapper",
1322
Long: "validate yamls, handle banners, start build from CLI",
14-
Version: "0.2.0",
23+
Version: fmt.Sprintf("%v, commit %v, built at %v", version, commit, date),
1524
Run: func(cmd *cobra.Command, args []string) {
1625
cmd.Help()
1726
},

0 commit comments

Comments
 (0)