forked from Staffbase/syseleven-exporter
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
37 lines (32 loc) · 1.33 KB
/
Makefile
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
BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
BUILDTIME ?= $(shell date '+%Y-%m-%d@%H:%M:%S')
BUILDUSER ?= $(shell id -un)
REPO ?= github.com/syseleven/syseleven-exporter
REVISION ?= $(shell git rev-parse HEAD)
VERSION ?= $(shell git describe --tags)
.PHONY: build release-major release-minor release-patch
build:
go build -ldflags "-X ${REPO}/pkg/version.Version=${VERSION} \
-X ${REPO}/pkg/version.Revision=${REVISION} \
-X ${REPO}/pkg/version.Branch=${BRANCH} \
-X ${REPO}/pkg/version.BuildUser=${BUILDUSER} \
-X ${REPO}/pkg/version.BuildDate=${BUILDTIME}" \
-o ./bin/syselevenexporter ./cmd/syselevenexporter;
release-major:
$(eval MAJORVERSION=$(shell git describe --tags --abbrev=0 | sed s/v// | awk -F. '{print $$1+1".0.0"}'))
git checkout main
git pull
git tag -a $(MAJORVERSION) -m 'release $(MAJORVERSION)'
git push origin --tags
release-minor:
$(eval MINORVERSION=$(shell git describe --tags --abbrev=0 | sed s/v// | awk -F. '{print $$1"."$$2+1".0"}'))
git checkout main
git pull
git tag -a $(MINORVERSION) -m 'release $(MINORVERSION)'
git push origin --tags
release-patch:
$(eval PATCHVERSION=$(shell git describe --tags --abbrev=0 | sed s/v// | awk -F. '{print $$1"."$$2"."$$3+1}'))
git checkout main
git pull
git tag -a $(PATCHVERSION) -m 'release $(PATCHVERSION)'
git push origin --tags