-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathTaskfile.yml
86 lines (76 loc) · 2.3 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
86
version: "3"
set: [errexit, nounset, pipefail]
shopt: [globstar]
includes:
lint:
taskfile: https://github.com/nikaro/meta/raw/tasks-v1/taskfiles/lint.yml
internal: true
format:
taskfile: https://github.com/nikaro/meta/raw/tasks-v1/taskfiles/format.yml
internal: true
go:
taskfile: https://github.com/nikaro/meta/raw/tasks-v1/taskfiles/go.yml
vars:
BUILD_TARGETS:
- linux/amd64
- linux/arm64
- darwin/amd64
- darwin/arm64
env:
APP: wirelogd
PREFIX:
sh: echo ${PREFIX:-/usr/local}
BINDIR:
sh: echo ${BINDIR:-${PREFIX:-/usr/local}/bin}
MANDIR:
sh: echo ${MANDIR:-${PREFIX:-/usr/local}/share/man}
SHAREDIR:
sh: echo ${SHAREDIR:-${PREFIX:-/usr/local}/share/${APP:-wirelogd}}
tasks:
init:
desc: Initialize repositry
cmds:
- git config core.hooksPath .githooks
- git config commit.template .gitmessage
lint:
desc: Run linters
cmds:
- task: lint:default
- task: go:lint
format:
desc: Run formatters
cmds:
- task: format:default
- task: go:format
bump:
desc: Bump version
preconditions:
- cz --no-raise 3,21 bump --dry-run --changelog --changelog-to-stdout > ./_changelog.md
cmd: cz --no-raise 3,21 bump --changelog --changelog-to-stdout > ./_changelog.md
release:
desc: Publish release
preconditions:
- test -n "$AUR_KEY"
- test -n "$GITHUB_TOKEN"
cmds:
- goreleaser release --clean --release-notes ./_changelog.md
- defer: rm -rf _changelog.md
install:
desc: Install the application
deps: ["go:build"]
cmds:
- install -Dm755 ./build/${APP}-${GOOS}-${GOARCH} ${BINDIR}/${APP}
- install -Dm644 ./man/${APP}.1 ${MANDIR}/man1/${APP}.1
- install -Dm644 ./contrib/config.json ${SHAREDIR}/config.json
- install -Dm644 ./contrib/${APP}.service ${SHAREDIR}/${APP}.service
- sed -i'' -e 's|/usr|${PREFIX}|g' ${SHAREDIR}/${APP}.service
uninstall:
desc: Uninstall the application
cmds:
- rm -rf ${BINDIR}/${APP}
- rm -f ${MANDIR}/man1/${APP}.1
- rm -f ${SHAREDIR}/*
- rmdir --ignore-fail-on-non-empty ${BINDIR}
- rmdir --ignore-fail-on-non-empty ${SHAREDIR}
- rmdir --ignore-fail-on-non-empty ${MANDIR}/man1
- rmdir --ignore-fail-on-non-empty ${MANDIR}