-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
90 lines (72 loc) · 2.13 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
90
NAME := alfred-helm-hub
WORKFLOW_FILENAME := alfred-helm-hub.alfredworkflow
VERSION_FILE := version
TARGET_FILES := $(shell cat include.list)
# must use system python
PYTHON := /usr/bin/python3
default: clean build
.PHONY: .venv
.venv:
poetry env use $(PYTHON)
poetry install
.PHONY: build
build: $(WORKFLOW_FILENAME)
requirements.txt:
poetry export --without-hashes > requirements.txt
%/.site-packages:
$(PYTHON) -m pip install \
--prefer-binary \
--upgrade \
--target=$@ \
${PACKAGES}
deps: requirements.txt
deps: PACKAGES=-r requirements.txt
deps: build/.site-packages
deps: $(TARGET_FILES)
$(WORKFLOW_FILENAME): deps
@echo "> Packaging..."
rm -f $(WORKFLOW_FILENAME)
BUILD_DIR=$(BUILD_DIR) WORKFLOW_FILENAME=$(WORKFLOW_FILENAME) ./build.sh
.PHONY: test
test:
python -m unittest discover -s tests -v
install: $(WORKFLOW_FILENAME)
open $(WORKFLOW_FILENAME)
.PHONY: clean
clean:
rm -rf \
requirements.txt \
./build/ \
.mypy_cache/ \
$(WORKFLOW_FILENAME)
.PHONY: bump_version
bump_version:
@if [ -z $(version) ]; then \
echo Usage: make bump_version version=1.0.0; \
exit 1; \
fi;
@echo Current version: $(shell cat $(VERSION_FILE))
@(read -e -p "Bump to version $(version)? [y/N]: " ans && case "$$ans" in [yY]) true;; *) false;; esac)
@echo $(version) > version
@potry version $(version)
@sed -i.bak 's#<string>[0-9]*.[0-9]*.[0-9]*</string>#<string>$(version)</string>#' info.plist
.PHONY: release
release:
@standard-version -a -s -t ""
.PHONY: release-major
release-major:
@standard-version -a -s -t "" --release-as major
.PHONY: release-minor
release-minor:
@standard-version -a -s -t "" --release-as minor
.PHONY: release-patch
release-patch:
@standard-version -a -s -t "" --release-as patch
.PHONY: release-github
release-github: VERSION=$(shell cat $(VERSION_FILE))
release-github:
@(read -e -p "Create Github release version $(VERSION)? [y/N]: " ans && case "$$ans" in [yY]) true;; *) false;; esac)
gh release create $(VERSION) $(WORKFLOW_FILENAME)
EXECUTABLES = $(PYTHON) plutil open rsync poetry
K := $(foreach exec,$(EXECUTABLES),\
$(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH")))