forked from volkszaehler/mbmd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (28 loc) · 1 KB
/
Makefile
File metadata and controls
39 lines (28 loc) · 1 KB
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
.PHONY: default clean install lint test build binaries publish-images test-release release
TAG_NAME := $(shell git tag -l --contains HEAD)
SHA := $(shell git rev-parse --short HEAD)
VERSION := $(if $(TAG_NAME),$(TAG_NAME),$(SHA))
BUILD_DATE := $(shell date -u '+%Y-%m-%d_%H:%M:%S')
BUILD_TAGS := -tags=release
LD_FLAGS := -X "github.com/volkszaehler/mbmd/server.Version=${VERSION}" -X "github.com/volkszaehler/mbmd/server.Commit=${SHA}"
BUILD_ARGS := -ldflags='$(LD_FLAGS)'
default: clean install lint test build
clean:
rm -rf dist/
install:
go install github.com/alvaroloes/enumer
lint:
golangci-lint run
test:
@echo "Running testsuite"
go test ./...
build:
@echo Version: $(VERSION) $(BUILD_DATE)
go build -v $(BUILD_TAGS) $(BUILD_ARGS)
publish-images:
@echo Version: $(VERSION) $(BUILD_DATE)
seihon publish -v "$(TAG_NAME)" -v "latest" --image-name volkszaehler/mbmd --base-runtime-image alpine --dry-run=false
test-release:
goreleaser --snapshot --skip-publish --rm-dist
release:
goreleaser --rm-dist