-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
37 lines (31 loc) · 1.3 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
.PHONY: CURRENT_VERSION now
GITBUCKET_RELEASE := $(shell wget -q --max-redirect=1 -S -O - https://github.com/takezoe/gitbucket/releases/latest 2>&1 | grep -ie 'Location: ' | grep -o "http.*" | grep "tag")
GITBUCKET_VERSION := $(shell echo $(GITBUCKET_RELEASE) | sed -e "s!^http.*/tag/!!")
DOWNLOAD_URL := https://github.com/takezoe/gitbucket/releases/download/$(GITBUCKET_VERSION)/gitbucket.war
$(info GITBUCKET_RELEASE $(GITBUCKET_RELEASE))
$(info GITBUCKET_VERSION $(GITBUCKET_VERSION))
$(info DOWNLOAD_URL $(DOWNLOAD_URL))
PLUGIN_GITBUCKET-GIST := https://github.com/takezoe/gitbucket-gist-plugin/releases/
all: CURRENT_VERSION Dockerfile commit
now:
rm -f now
echo $(GITBUCKET_VERSION) > now
CURRENT_VERSION: now
if ! grep -q `cat now` CURRENT_VERSION; then cp $< $@; make clean; fi
rm -f now
Dockerfile: Dockerfile.in
echo ${GITBUCKET_VERSION}
sed -e "s!@GITBUCKET_RELEASE@!${GITBUCKET_RELEASE}!g" \
-e "s!@GITBUCKET_VERSION@!${GITBUCKET_VERSION}!g" \
-e "s!@DOWNLOAD_URL@!${DOWNLOAD_URL}!g" $< > $@
commit: Dockerfile
if (git status | sed -ne "s/.*modified:\s*// p" | grep -q $<) ; then \
git pull --all ;\
git add $< ;\
git commit -a -m "Gitbucket version: ${GITBUCKET_VERSION}" ;\
git tag ${GITBUCKET_VERSION} ;\
git push --all ;\
git push --tags ;\
fi
clean:
rm -f Dockerfile now