Skip to content

Commit e5d5fb5

Browse files
committed
goreleaser
1 parent 8969107 commit e5d5fb5

File tree

5 files changed

+64
-0
lines changed

5 files changed

+64
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.idea
22
download
3+
dist
34
main
45
toolbox*

.goreleaser.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# This is an example goreleaser.yaml file with some sane defaults.
2+
# Make sure to check the documentation at http://goreleaser.com
3+
builds:
4+
- env:
5+
- CGO_ENABLED=0
6+
ldflags:
7+
- -s -w -X github.com/bakito/toolbox/version.Version={{.Version}}
8+
goos:
9+
- linux
10+
- windows
11+
#- darwin
12+
goarch:
13+
# - 386
14+
- amd64
15+
hooks:
16+
post: upx {{ .Path }}
17+
checksum:
18+
name_template: 'checksums.txt'
19+
snapshot:
20+
name_template: "{{ .Tag }}-next"
21+
changelog:
22+
sort: asc
23+
filters:
24+
exclude:
25+
- '^docs:'
26+
- '^test:'

Makefile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Run go fmt against code
2+
fmt:
3+
go fmt ./...
4+
gofmt -s -w .
5+
6+
# Run go vet against code
7+
vet:
8+
go vet ./...
9+
10+
# Run go mod tidy
11+
tidy:
12+
go mod tidy
13+
14+
# Run tests
15+
test: tidy fmt vet
16+
go test ./... -coverprofile=coverage.out
17+
go tool cover -func=coverage.out
18+
19+
release: semver
20+
@version=$$(semver); \
21+
git tag -s $$version -m"Release $$version"
22+
goreleaser --rm-dist
23+
24+
test-release:
25+
goreleaser --skip-publish --snapshot --rm-dist
26+
27+
semver:
28+
ifeq (, $(shell which semver))
29+
$(shell go install github.com/bakito/semver@latest)
30+
endif

main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"bytes"
55
"fmt"
6+
"github.com/bakito/toolbox/version"
67
"log"
78
"os"
89
"path/filepath"
@@ -29,6 +30,8 @@ var (
2930

3031
func main() {
3132

33+
log.Printf("toolbox v%s", version.Version)
34+
3235
tb, err := readToolbox()
3336
if err != nil {
3437
panic(err)

version/version.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package version
2+
3+
// Version the module version
4+
var Version = "devel"

0 commit comments

Comments
 (0)