forked from kubemq-io/kubemq-sources
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
89 lines (88 loc) · 2.75 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
87
88
89
version: '3'
vars:
BINARY_NAME: kubemq-sources
VERSION: v1.6.2
REPO_GCP: europe-docker.pkg.dev/kubemq/images
REPO_DOCKERHUB: kubemq
tasks:
default:
cmds:
- go build -buildmode=exe -o "{{.BINARY_NAME}}.exe"
check_update:
cmds:
- go-mod-upgrade
lint:
cmds:
- golangci-lint run --disable gocritic --enable misspell
test:
cmds:
- go test -timeout 30m ./...
build:
env:
GOOS: '{{OS}}'
GOARCH: '{{ARCH}}'
cmds:
- go mod tidy
- go mod vendor
- go build -o "{{.BINARY_NAME}}.exe" -ldflags "-X main.version={{.VERSION}}"
build_container:
env:
GOOS: '{{OS}}'
GOARCH: '{{ARCH}}'
cmds:
- go build -tags container -o "{{.BINARY_NAME}}.exe" -ldflags "-X main.version={{.VERSION}}"
docker:
env:
GOOS: linux
GOARCH: amd64
cmds:
- go mod tidy
- go mod vendor
- DOCKER_BUILDKIT=0 docker build --build-arg VERSION={{.VERSION}} . -t kubemq/{{.BINARY_NAME}}:{{.VERSION}}
- docker tag kubemq/{{.BINARY_NAME}}:{{.VERSION}} kubemq/{{.BINARY_NAME}}:latest
push:
cmds:
- docker push kubemq/{{.BINARY_NAME}}:{{.VERSION}}
- docker push kubemq/{{.BINARY_NAME}}:latest
run_docker:
cmds:
- docker run -it --rm kubemq/{{.BINARY_NAME}}:latest
update-manifest:
cmds:
- go build -buildmode=exe -o "{{.BINARY_NAME}}.exe"
- ./{{.BINARY_NAME}}.exe --manifest
commit-modifed:
cmds:
- git add -A
- git commit -a -m "release {{.VERSION}}"
- git push origin master
goreleaser:
cmds:
- goreleaser --snapshot --skip-publish --rm-dist
tag:
cmds:
- git tag -a {{.VERSION}} -m {{.VERSION}}
- git push origin master --tags
release:
cmds:
- go mod vendor
- task: update-manifest
- task: commit-modifed
- task: docker
- task: push
- task: tag
docker_prod:
cmds:
- go mod tidy
- go mod vendor
- docker buildx build --platform linux/amd64,linux/arm64 --build-arg VERSION={{.VERSION}} . -t {{.REPO_GCP}}/{{.BINARY_NAME}}:{{.VERSION}} --push
- docker pull {{.REPO_GCP}}/{{.BINARY_NAME}}:{{.VERSION}}
- docker tag {{.REPO_GCP}}/{{.BINARY_NAME}}:{{.VERSION}} {{.REPO_GCP}}/{{.BINARY_NAME}}:latest
- docker push {{.REPO_GCP}}/{{.BINARY_NAME}}:latest
- docker tag {{.REPO_GCP}}/{{.BINARY_NAME}}:{{.VERSION}} {{.REPO_DOCKERHUB}}/{{.BINARY_NAME}}:{{.VERSION}}
- docker tag {{.REPO_GCP}}/{{.BINARY_NAME}}:{{.VERSION}} {{.REPO_DOCKERHUB}}/{{.BINARY_NAME}}:latest
- docker push {{.REPO_DOCKERHUB}}/{{.BINARY_NAME}}:{{.VERSION}}
- docker push {{.REPO_DOCKERHUB}}/{{.BINARY_NAME}}:latest
trivy:
cmds:
- trivy image --exit-code 1 --severity HIGH,CRITICAL kubemq/{{.BINARY_NAME}}:{{.VERSION}}