forked from kiali/kiali.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.site.jenkins
51 lines (42 loc) · 1.6 KB
/
Makefile.site.jenkins
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
# This Makefile is used to automate Kaili website releases.
# Please, see documentation in RELEASING.adoc
RELEASE_TYPE ?= 'minor'
SITE_VERSION ?= $(shell sed -rn 's/^VERSION \?= v(.*)/\1/p' Makefile)
# Take the version as-is without filtering out the 'v' (if it exists)
# This will take 'latest' as is or vX.Y.Z-type.
VERSION_TAG ?= $(shell sed -rn 's/^VERSION \?= (.*)/\1/p' Makefile)
SITE_GITHUB_URI ?= git@github.com:kiali/kiali.io.git
SITE_PULL_URI ?= https://api.github.com/repos/kiali/kiali.io/pulls
SITE_RELEASE_URI = $(subst pulls,releases,$(SITE_PULL_URI))
SITE_MAIN_BRANCH ?= master
ifeq ($(SHOULD_RELEASE_SITE),auto)
ifeq ($(RELEASE_TYPE),minor)
PUSH_CHANGES = y
endif
else
ifeq ($(SHOULD_RELEASE_SITE),y)
PUSH_CHANGES = y
else
PUSH_CHANGES = n
endif
endif
# NOTE: The value fo SITE_BUMPED_VERSION and SITE_VERSION_BRANCH will only be valid
# after the main Makefile has been modified with the version being released.
SITE_BUMPED_VERSION ?= $(shell semver bump minor $(SITE_VERSION))
.PHONY: website-build-archive
.PHONY: all release
all:
$(error You must explicitly specify a target)
website-build-archive:
ifeq ($(PUSH_CHANGES),y)
@echo "Will build version: $(SITE_VERSION)"
sed -i -r 's/^VERSION \?= v.*/VERSION \?= v$(SITE_BUMPED_VERSION)/' Makefile
./scripts/build-archive.sh v$(SITE_VERSION)
git add -A
git commit -m "Release v$(SITE_VERSION)"
git push $(SITE_GITHUB_URI) $$(git rev-parse HEAD):$(SITE_MAIN_BRANCH)
git push $(SITE_GITHUB_URI) $$(git rev-parse HEAD):refs/tags/v$(SITE_VERSION)
else
@echo "Skipped website release on patch or snapshot releases"
endif
release: website-build-archive