-
Notifications
You must be signed in to change notification settings - Fork 1
/
Taskfile.yml
85 lines (83 loc) · 2.33 KB
/
Taskfile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
version: '2'
output: 'prefixed'
vars:
CGO_ENABLED: 0
PATH: 'github.com/MarkusFreitag/changelogger'
BINARY_NAME: 'changelogger'
tasks:
all:
deps: [build]
build:
desc: Start the build process
deps:
- task: clean
- task: bin
format:
desc: Run gofmt for the project
cmds:
- bash -c "diff -u <(echo -n) <(go fmt ./...)"
lint:
desc: Run golangci-lint for the project
deps: [format]
cmds:
- golangci-lint run
test:
desc: Run go test unittests
cmds:
- mkdir -p coverage
- go test -v ./... -coverprofile=coverage/coverage.out
coverage:
desc: Generate coverage report
deps: [test]
cmds:
- go tool cover -html=coverage/coverage.out -o coverage/coverage.html
clean:
desc: Clean up files of the build process
cmds:
- rm -rf ci-build/ coverage/
bin:
desc: Build the go binary
cmds:
- go build -a -ldflags "-X {{.PATH}}/cmd.BuildDate={{.DATE}} -X {{.PATH}}/cmd.BuildVersion={{.VERSION}} -extldflags '-static' -s -w" -o ci-build/{{.BINARY_NAME}}
vars:
DATE:
sh: date -Iseconds
VERSION:
sh: git describe --tags || git describe --always
changelog:
desc: Add a new changelog entry
cmds:
- ish: changelogger
release:
desc: Create a new release
cmds:
- ish: changelogger release new
ignore_error: yes
- git add CHANGELOG.md
- git commit -m "Bump version to $(changelogger release last --version-only)" -m "$(changelogger release last)"
- git tag -a "$(changelogger release last --version-only)" -m "$(changelogger release last)"
- git push
- git push --tags
env:
CHANGELOGGER_VERSION_FORMAT: semver
go-get:
cmds:
- go get -u {{.REPO}}
dl-deps:
desc: Downloads cli dependencies
cmds:
- task: go-get
vars: {REPO: github.com/golangci/golangci-lint}
- task: go-get
vars: {REPO: github.com/goreleaser/goreleaser}
- task: go-get
vars: {REPO: github.com/goreleaser/godownloader}
generate-install-script:
desc: Generate install script using https://github.com/goreleaser/godownloader
cmds:
- godownloader --repo MarkusFreitag/changelogger -o install-changelogger.sh
- cp ./install-changelogger.sh ./docs/install.sh
ci:
desc: Run ci tasks
cmds:
- task: test