-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
84 lines (75 loc) · 2.65 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
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
BUILD_ORG := ca17
BUILD_VERSION := latest
BUILD_TIME := $(shell date "+%F %T")
BUILD_NAME := teamsedge
RELEASE_VERSION := v1.0.1
SOURCE := main.go
RELEASE_DIR := ./release
COMMIT_SHA1 := $(shell git show -s --format=%H )
COMMIT_DATE := $(shell git show -s --format=%cD )
COMMIT_USER := $(shell git show -s --format=%ce )
COMMIT_SUBJECT := $(shell git show -s --format=%s )
clean:
rm -f teamsedge
build:
go generate
CGO_ENABLED=0 go build -a -ldflags \
'\
-X "main.BuildVersion=${BUILD_VERSION}"\
-X "main.ReleaseVersion=${RELEASE_VERSION}"\
-X "main.BuildTime=${BUILD_TIME}"\
-X "main.BuildName=${BUILD_NAME}"\
-X "main.CommitID=${COMMIT_SHA1}"\
-X "main.CommitDate=${COMMIT_DATE}"\
-X "main.CommitUser=${COMMIT_USER}"\
-X "main.CommitSubject=${COMMIT_SUBJECT}"\
-s -w -extldflags "-static"\
' \
-o ${BUILD_NAME} ${SOURCE}
build-linux:
echo ${RELEASE_VERSION}_${BUILD_TIME} > ./assets/build.txt
go generate
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags \
'\
-X "main.BuildVersion=${BUILD_VERSION}"\
-X "main.ReleaseVersion=${RELEASE_VERSION}"\
-X "main.BuildTime=${BUILD_TIME}"\
-X "main.BuildName=${BUILD_NAME}"\
-X "main.CommitID=${COMMIT_SHA1}"\
-X "main.CommitDate=${COMMIT_DATE}"\
-X "main.CommitUser=${COMMIT_USER}"\
-X "main.CommitSubject=${COMMIT_SUBJECT}"\
-s -w -extldflags "-static"\
' \
-o ${RELEASE_DIR}/${BUILD_NAME} ${SOURCE}
fastpub:
echo "BuildVersion=${BUILD_VERSION}" > assets/build.txt
echo "ReleaseVersion=${RELEASE_VERSION}" >> assets/build.txt
echo "BuildTime=${BUILD_TIME}" >> assets/build.txt
echo "BuildName=${BUILD_NAME}" >> assets/build.txt
echo "CommitID=${COMMIT_SHA1}" >> assets/build.txt
echo "CommitDate=${COMMIT_DATE}" >> assets/build.txt
echo "CommitUser=${COMMIT_USER}" >> assets/build.txt
echo "CommitSubject=${COMMIT_SUBJECT}" >> assets/build.txt
docker build --build-arg BTIME="$(shell date "+%F %T")" -t teamsedge . -f Dockerfile
ci:
@read -p "type commit message: " cimsg; \
git ci -am "$(shell date "+%F %T") $${cimsg}"
syncwjt:
@read -p "提示:同步操作尽量在完成一个完整功能特性后进行,请输入提交描述 (wjt): " cimsg; \
git commit -am "$(shell date "+%F %T") : $${cimsg}" || echo "no commit"
# 切换主分支并更新
git checkout develop
git pull origin develop
# 切换开发分支变基合并提交
git checkout wjt
git rebase -i develop
# 切换回主分支并合并开发者分支,推送主分支到远程,方便其他开发者合并
git checkout develop
git merge --no-ff wjt
git push origin develop
# 切换回自己的开发分支继续工作
git checkout wjt
gitlog:
git log --oneline
.PHONY: clean build