This repository has been archived by the owner on Dec 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Makefile
60 lines (46 loc) · 1.7 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
.PHONY: all release xpi test sign sign-update check-env check-jwt-issuer check-jwt-secret
SOURCES := $(wildcard *.js) $(wildcard lib/*.js)
INSTALL_RDF_PATCH := $(abspath install.rdf.patch)
UNSIGNED_XPI := zotero-voyant-export.xpi
UHURA := uhura
VERSION := $(shell cat VERSION)
SIGNED_FILE := zotero_voyant_export-$(VERSION)-fx.xpi
UPDATE_RDF := update.rdf
UPDATELINK := https://github.com/corajr/zotero-voyant-export/releases/download/v$(VERSION)/$(SIGNED_FILE)
all: xpi
xpi: $(UNSIGNED_XPI)
package.json: package.json.template VERSION
sed s/VERSION/$(VERSION)/g < $< | sed sXUPDATELINKX$(UPDATELINK)X > $@
$(UNSIGNED_XPI): package.json $(SOURCES) $(INSTALL_RDF_PATCH)
rm -f $@
jpm xpi --dest-dir /tmp
rm -rf /tmp/zotero-voyant-export
mkdir -p /tmp/zotero-voyant-export
(cd /tmp/zotero-voyant-export && unzip /tmp/zotero-voyant-export.xpi && \
patch install.rdf $(INSTALL_RDF_PATCH))
(cd /tmp/zotero-voyant-export && zip -r $(abspath $@) .)
test:
jpm test -b "/Applications/Nightly.app"
check-env: check-jwt-issuer check-jwt-secret
check-jwt-issuer:
ifndef JWT_ISSUER
$(error JWT_ISSUER is undefined)
endif
check-jwt-secret:
ifndef JWT_SECRET
$(error JWT_SECRET is undefined)
endif
sign: $(SIGNED_FILE)
$(SIGNED_FILE): $(UNSIGNED_XPI) check-env
jpm sign --api-key $(JWT_ISSUER) --api-secret $(JWT_SECRET) --xpi $<
$(UPDATE_RDF): $(SIGNED_FILE)
# run twice in case of error?
$(UHURA) -k $(UHURA_PEM_FILE) $(SIGNED_FILE) $(UPDATELINK) > $@ || $(UHURA) -k $(UHURA_PEM_FILE) $(SIGNED_FILE) $(UPDATELINK) > $@
cp -f $@ /tmp/update.rdf
release: $(SIGNED_FILE) $(UPDATE_RDF)
git checkout gh-pages
cp -f /tmp/update.rdf ./update.rdf
git add update.rdf
git commit -m "version $(VERSION)"
git push
git checkout master