forked from elgatito/context.elementum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (38 loc) · 1.11 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
NAME = context.elementum
GIT = git
GIT_VERSION = $(shell $(GIT) describe --abbrev=0 --tags)
GIT_USER = elgatito
GIT_REPOSITORY = context.elementum
TAG_VERSION = $(subst v,,$(GIT_VERSION))
LAST_COMMIT = $(shell $(GIT) log -1 --pretty=\%B)
VERSION = $(shell sed -ne "s/.*version=\"\([0-9a-z\.\-]*\)\" provider-name=\"elgatito\".*/\1/p" addon.xml)
ZIP_SUFFIX = zip
ZIP_FILE = $(NAME)-$(VERSION).$(ZIP_SUFFIX)
all: clean zip
$(ZIP_FILE):
$(GIT) archive --format zip --prefix $(NAME)/ --output $(ZIP_FILE) HEAD
rm -rf $(NAME)
zip: $(ZIP_FILE)
clean_arch:
rm -f $(ZIP_FILE)
clean:
rm -f $(ZIP_FILE)
rm -rf $(NAME)
upload:
$(eval EXISTS := $(shell github-release info --user $(GIT_USER) --repo $(GIT_REPOSITORY) --tag v$(VERSION) 1>&2 2>/dev/null; echo $$?))
ifneq ($(EXISTS),1)
github-release release \
--user $(GIT_USER) \
--repo $(GIT_REPOSITORY) \
--tag v$(VERSION) \
--name "$(VERSION)" \
--description "$(VERSION)"
endif
sleep 5
github-release upload \
--user $(GIT_USER) \
--repo $(GIT_REPOSITORY) \
--replace \
--tag v$(VERSION) \
--file $(NAME)-$(VERSION).zip \
--name $(NAME)-$(VERSION).zip