-
Notifications
You must be signed in to change notification settings - Fork 9
/
Taskfile.yml
50 lines (42 loc) · 1.49 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
version: '2'
vars:
GIT_VERSION:
sh: git describe --tags --always | sed 's/v//g'
tasks:
build:
cmds:
- go build -ldflags "-w -s -X main.appVersion={{.GIT_VERSION}}" -o dist/banisher
build-with-docker:
cmds:
- docker run --rm -v $PWD:/go/src banisher-compile:latest /bin/sh -c 'task build'
run:
deps: [build]
cmds:
- dist/banisher
package:
deps: [build-with-docker]
vars:
PACKAGE_BUILD_DATE:
sh: date +%s
cmds:
- mkdir -p dist/packages/debian/DEBIAN
- cp debian/postinst dist/packages/debian/DEBIAN/.
- cp debian/prerm dist/packages/debian/DEBIAN/.
- cp debian/control dist/packages/debian/DEBIAN/.
- cp debian/conffiles dist/packages/debian/DEBIAN/.
- sed -i 's/#version#/{{.GIT_VERSION}}-{{.PACKAGE_BUILD_DATE}}/g' dist/packages/debian/DEBIAN/control
- mkdir -p dist/packages/debian/lib/systemd/system
- cp debian/banisher.service dist/packages/debian/lib/systemd/system/.
- mkdir -p dist/packages/debian/usr/sbin
- cp dist/banisher dist/packages/debian/usr/sbin/.
- mkdir -p dist/packages/debian/etc
- cp dist/config.yml dist/packages/debian/etc/banisher.yml
- dpkg-deb --root-owner-group -Zxz --build dist/packages/debian dist/banisher_{{.GIT_VERSION}}-{{.PACKAGE_BUILD_DATE}}_amd64.deb
generate-docker-image:
cmds:
- docker build --tag banisher-compile .
clean:
cmds:
- rm dist/*.deb
- rm dist/packages -R
- rm dist/banisher