-
Notifications
You must be signed in to change notification settings - Fork 31
/
Makefile
89 lines (74 loc) · 2.17 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
83
84
85
86
87
88
89
MARK_NIGHTLY := "nightly"
MARK_UNSTABLE := "unstable"
GIT_BRANCH := "unknown"
GIT_HASH := $(shell git log --pretty=format:%H -n 1)
GIT_HASH_SHORT := $(shell echo "${GIT_HASH}" | cut -c1-7)
GIT_TAG := $(shell git describe --always --tags --abbrev=0 | tail -c+2)
GIT_COMMIT := $(shell git rev-list v${GIT_TAG}..HEAD --count)
GIT_COMMIT_DATE := $(shell git show -s --format=%ci | cut -d\ -f1)
VERSION_FEATURE := ${GIT_TAG}-$(shell echo $(GIT_BRANCH) | cut -c1-100).${GIT_COMMIT_DATE}.${GIT_HASH_SHORT}
VERSION_NIGHTLY := ${GIT_COMMIT_DATE}.${GIT_HASH_SHORT}
VERSION_RELEASE := ${GIT_TAG}.${GIT_COMMIT}
VENDOR := "SKB Kontur"
URL := "https://github.com/moira-alert/web2.0"
LICENSE := "MIT"
.PHONY: default
default: lint build
.PHONY: prepare
prepare:
yarn install
.PHONY: build
build: prepare
yarn run build
.PHONY: lint
lint: prepare
yarn run lint
.PHONY: clean
clean:
rm -rf build
.PHONY: tar
tar:
mkdir -p build/root/var/www/moira || true
cp -rf dist/* build/root/var/www/moira/
tar -czvPf build/moira-web2-${VERSION_RELEASE}.tar.gz -C build/root .
.PHONY: rpm
rpm:
fpm -t rpm \
-s "tar" \
--description "Moira web2" \
--vendor ${VENDOR} \
--url ${URL} \
--license ${LICENSE} \
--name "moira-web2" \
--version "${VERSION_RELEASE}" \
--iteration "1" \
-p build \
build/moira-web2-${VERSION_RELEASE}.tar.gz
.PHONY: deb
deb:
fpm -t deb \
-s "tar" \
--description "Moira web2" \
--vendor ${VENDOR} \
--url ${URL} \
--license ${LICENSE} \
--name "moira-web2" \
--version "${VERSION_RELEASE}" \
--iteration "1" \
-p build \
build/moira-web2-${VERSION_RELEASE}.tar.gz
.PHONY: packages
packages: clean build tar rpm deb
.PHONY: docker_feature_image
docker_feature_image:
docker build -t moira/web2-${MARK_UNSTABLE}:${VERSION_FEATURE} .
docker push moira/web2-${MARK_UNSTABLE}:${VERSION_FEATURE}
.PHONY: docker_nightly_image
docker_nightly_image:
docker build -t moira/web2-${MARK_NIGHTLY}:${VERSION_NIGHTLY} .
docker push moira/web2-${MARK_NIGHTLY}:${VERSION_NIGHTLY}
.PHONY: docker_release_image
docker_release_image:
docker build -t moira/web2:${VERSION_RELEASE} -t moira/web2:latest .
docker push moira/web2:${VERSION_RELEASE}
docker push moira/web2:latest