-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
68 lines (52 loc) · 1.79 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
MD_FILES := $(shell find ./ -type f -name '*.md')
GO_FILES := $(shell find ./ -type f -name '*.go' | grep -v "generated")
TK := npx bazelisk run //:theme --
LINT := yarn theme-lint
BZL := yarn bazelisk --
BZL_BIN := $(shell npx bazelisk info bazel-bin)
VERSION := $(shell cat content/.version | tr -d '\n')
.PHONY: deploy/theme,deploy/contents,watch,download/theme
deploy/theme:
$(TK) deploy --dir theme
deploy/contents: $(MD_FILES)
$(BZL) run //content/cmd/content -- deploy \
--input $(PWD)/contents \
--domain k9books.myshopify.com \
--key $(MARKDOWN_APP_KEY) \
--secret $(MARKDOWN_APP_SECRET) \
--token $(MARKDOWN_APP_SECRET)
download/contents: $(MD_FILES)
$(BZL) run //content/cmd/content -- download \
--output $(PWD)/contents \
--domain k9books.myshopify.com \
--key $(MARKDOWN_APP_KEY) \
--secret $(MARKDOWN_APP_SECRET) \
--token $(MARKDOWN_APP_SECRET)
watch:
$(TK) watch --dir theme
download/theme:
$(TK) --dir theme download
lint:
$(LINT) ./theme
gqlgenc/client/client.go: gqlgenc/main.go gqlgenc/*.gql
$(BZL) run gqlgenc
cp -r $(BZL_BIN)/gqlgenc/gqlgenc_/gqlgenc.runfiles/k9books/gqlgenc/client $(CURDIR)/gqlgenc
k9bookshelf/content: $(GO_FILES) WORKSPACE
mkdir -p k9bookshelf
for target in darwin_amd64 linux_amd64 ; do \
$(BZL) build --platforms=@io_bazel_rules_go//go/toolchain:$$target //content/cmd/content ; \
cp -f $(BZL_BIN)/content/cmd/content/content_/content k9bookshelf/$(VERSION)-content.$$target ; \
done
.PHONY: release
release:
git tag -af "$(VERSION)" -m ""
.PHONY: setup
setup: WORKSPACE */BUILD.bazel GOPATH
.PHONY: content/BUILD.bazel gqlgenc/BUILD.bazel
*/BUILD.bazel: $(GO_FILES)
$(BZL) run //:gazelle
WORKSPACE: go.mod content/BUILD.bazel
$(BZL) run //:gazelle -- update-repos -from_file=go.mod
.PHONY: GOPATH
GOPATH:
$(BZL) build //:gopath