-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (33 loc) · 1.37 KB
/
Makefile
File metadata and controls
42 lines (33 loc) · 1.37 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
40
41
42
MAIN_VER=$(shell awk -F "v" 'NR==1{print $$2;exit}' CHANGELOG.md)
GIT_CNT=$(shell git rev-list --count HEAD)
VERSION=${MAIN_VER}.${GIT_CNT}
BRANCH:=$(shell git rev-parse --abbrev-ref HEAD)
COMMIT_MSG=$(shell git log --pretty=format:"%B" -2)
REMOTE=$(shell git remote -v | grep "beeme" | awk '{print $$1;exit}')
REV=$(shell git rev-parse --short HEAD)
DATE=$(shell date "+%Y-%m-%d %H:%M:%S")
DEPLOY=$(shell awk '$$1=="Deploy"{print $$2;exit}' conf/config.toml)
all:
go build -i -v -ldflags "-X 'main.version=version: ${VERSION}, git_version: ${GIT_CNT}(${REV}) date: ${DATE}'" -o beeme-${BRANCH}-v${VERSION}
linux:
GOOS=linux go build -i -v -ldflags "-X 'main.version=version: ${VERSION}, git_version: ${GIT_CNT}(${REV}) date: ${DATE}'" -o beeme-${BRANCH}-v${VERSION}
debug:
go build -i -v -race -gcflags "-N -l" -o beeme-debug
check_branch_master:
ifneq (${BRANCH}, master)
echo "branch is not master"
exit 1
endif
release: check_branch_master
git pull ${REMOTE} ${BRANCH}
$(eval NEW_MAIN_VER=$(shell awk -F "v" 'NR==1{print $$2;exit}' CHANGELOG.md))
$(eval NEW_GIT_CNT=$(shell git rev-list --count HEAD))
$(eval NEW_VERSION=${NEW_MAIN_VER}.${NEW_GIT_CNT})
git tag -a v${NEW_MAIN_VER} -m "rc v${NEW_VERSION}"
git push ${REMOTE} v${NEW_MAIN_VER}
run:
rm -f routers/commentsRouter*
bee run -gendoc=true
build:
sh build.sh
.PHONY: all linux check_branch_master upload release run build