-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
104 lines (94 loc) · 6.28 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
don: don_bare $(shell find migrations public templates -type f) build/entry-server-bundle.js build/entry-client-bundle.js
@echo "--> Appending static content"
@cp -a don_bare don
@rice append --exec don
don_bare: *.go $(shell find acct activitystreams commonxml hostmeta pubsub react webfinger workergroup -type f)
@echo "--> Building don with host toolchain"
@go build -v -ldflags=-s -o don_bare
build/entry-server-bundle.js: $(shell find client/src -type f) client/webpack.* client/yarn.lock client/package.json
ifeq ($(JS_TOOLCHAIN),host)
@echo "--> Building server JavaScript bundle with host toolchain"
@cd client; yarn && yarn run build-server
@touch build/entry-server-bundle.js
else
@echo "--> Building server JavaScript bundle via docker"
@docker run --rm -it -v `pwd`:/app deoxxa/node-yarn:7.4 bash -c 'cd /app/client && yarn && yarn run build-server'
@touch build/entry-server-bundle.js
endif
build/entry-client-bundle.js: $(shell find client/src -type f) client/webpack.* client/yarn.lock client/package.json
ifeq ($(JS_TOOLCHAIN),host)
@echo "--> Building client JavaScript bundle with host toolchain"
@cd client; yarn && yarn run build-client
@touch build/entry-client-bundle.js
else
@echo "--> Building client JavaScript bundle via docker"
@docker run --rm -it -v `pwd`:/app deoxxa/node-yarn:7.4 bash -c 'cd /app/client && yarn && yarn run build-client'
@touch build/entry-client-bundle.js
endif
cross.stamp: *.go $(shell find acct activitystreams commonxml hostmeta pubsub react webfinger workergroup -type f) $(shell find migrations public templates -type f) build/entry-server-bundle.js build/entry-client-bundle.js
@echo "--> Building cross-platform binaries"
@xgo -targets 'darwin/amd64,linux/amd64,linux/arm,linux/arm64,windows/amd64' .
@rice append --exec don-darwin-10.6-amd64
@rice append --exec don-linux-amd64
@rice append --exec don-linux-arm64
@rice append --exec don-linux-arm-5
@rice append --exec don-windows-4.0-amd64.exe
@touch cross.stamp
.PHONY: cross release clean live_reload
BINTRAY_USER ?= deoxxa
BINTRAY_REPO ?= don
BINTRAY_PACKAGE ?= portable
BINTRAY_VERSION ?= dev
cross: cross.stamp
clean:
@echo "--> Removing build artifacts"
@rm -rvf cross.stamp don don_bare don-darwin-10.6-amd64 don-linux-amd64 don-linux-arm64 don-linux-arm-5 don-windows-4.0-amd64.exe build/*
live_reload: don_bare
@echo
@echo
@echo "--> Starting live reload environment..."
@echo "--> Please open http://127.0.0.1:5100 in your browser once everything is running"
@echo
@echo
@sleep 3
@go get github.com/ddollar/forego
@forego start -f Procfile.live_reload
release: cross.stamp
ifeq ($(BINTRAY_VERSION) , dev)
@echo "--> Removing dev Version"
@curl --silent --request DELETE --user "${BINTRAY_AUTH}" "https://api.bintray.com/packages/${BINTRAY_USER}/${BINTRAY_REPO}/${BINTRAY_PACKAGE}/versions/${BINTRAY_VERSION}"
@echo
endif
@echo "--> Uploading version: ${BINTRAY_VERSION}"
@echo "... darwin-amd64"
@curl --output /dev/null --progress-bar --upload-file don-darwin-10.6-amd64 --user "${BINTRAY_AUTH}" "https://api.bintray.com/content/${BINTRAY_USER}/${BINTRAY_REPO}/${BINTRAY_PACKAGE}/${BINTRAY_VERSION}/${BINTRAY_REPO}_${BINTRAY_VERSION}_darwin-amd64"
@echo "... linux-amd64"
@curl --output /dev/null --progress-bar --upload-file don-linux-amd64 --user "${BINTRAY_AUTH}" "https://api.bintray.com/content/${BINTRAY_USER}/${BINTRAY_REPO}/${BINTRAY_PACKAGE}/${BINTRAY_VERSION}/${BINTRAY_REPO}_${BINTRAY_VERSION}_linux-amd64"
@echo "... linux-arm64"
@curl --output /dev/null --progress-bar --upload-file don-linux-arm64 --user "${BINTRAY_AUTH}" "https://api.bintray.com/content/${BINTRAY_USER}/${BINTRAY_REPO}/${BINTRAY_PACKAGE}/${BINTRAY_VERSION}/${BINTRAY_REPO}_${BINTRAY_VERSION}_linux-arm64"
@echo "... linux-arm"
@curl --output /dev/null --progress-bar --upload-file don-linux-arm-5 --user "${BINTRAY_AUTH}" "https://api.bintray.com/content/${BINTRAY_USER}/${BINTRAY_REPO}/${BINTRAY_PACKAGE}/${BINTRAY_VERSION}/${BINTRAY_REPO}_${BINTRAY_VERSION}_linux-arm"
@echo "... windows-amd64"
@curl --output /dev/null --progress-bar --upload-file don-windows-4.0-amd64.exe --user "${BINTRAY_AUTH}" "https://api.bintray.com/content/${BINTRAY_USER}/${BINTRAY_REPO}/${BINTRAY_PACKAGE}/${BINTRAY_VERSION}/${BINTRAY_REPO}_${BINTRAY_VERSION}_windows-amd64.exe"
@echo "--> Publishing version ${BINTRAY_VERSION}"
@curl --silent --request POST --user "${BINTRAY_AUTH}" "https://api.bintray.com/content/${BINTRAY_USER}/${BINTRAY_REPO}/${BINTRAY_PACKAGE}/${BINTRAY_VERSION}/publish"
@echo
@echo "--> Waiting a little while for bintray to completely publish ${BINTRAY_VERSION}"
@echo "... 30s"
@sleep 10
@echo "... 20s"
@sleep 10
@echo "... 10s"
@sleep 10
@echo "--> Making files visible"
@echo "... darwin-amd64"
@curl --output /dev/null --silent --user "${BINTRAY_AUTH}" --request PUT --header 'content-type: application/json' --data-binary '{"list_in_downloads": true}' "https://api.bintray.com/file_metadata/${BINTRAY_USER}/${BINTRAY_REPO}/${BINTRAY_REPO}_${BINTRAY_VERSION}_darwin-amd64"
@echo "... linux-amd64"
@curl --output /dev/null --silent --user "${BINTRAY_AUTH}" --request PUT --header 'content-type: application/json' --data-binary '{"list_in_downloads": true}' "https://api.bintray.com/file_metadata/${BINTRAY_USER}/${BINTRAY_REPO}/${BINTRAY_REPO}_${BINTRAY_VERSION}_linux-amd64"
@echo "... linux-arm64"
@curl --output /dev/null --silent --user "${BINTRAY_AUTH}" --request PUT --header 'content-type: application/json' --data-binary '{"list_in_downloads": true}' "https://api.bintray.com/file_metadata/${BINTRAY_USER}/${BINTRAY_REPO}/${BINTRAY_REPO}_${BINTRAY_VERSION}_linux-arm64"
@echo "... linux-arm"
@curl --output /dev/null --silent --user "${BINTRAY_AUTH}" --request PUT --header 'content-type: application/json' --data-binary '{"list_in_downloads": true}' "https://api.bintray.com/file_metadata/${BINTRAY_USER}/${BINTRAY_REPO}/${BINTRAY_REPO}_${BINTRAY_VERSION}_linux-arm"
@echo "... windows-amd64"
@curl --output /dev/null --silent --user "${BINTRAY_AUTH}" --request PUT --header 'content-type: application/json' --data-binary '{"list_in_downloads": true}' "https://api.bintray.com/file_metadata/${BINTRAY_USER}/${BINTRAY_REPO}/${BINTRAY_REPO}_${BINTRAY_VERSION}_windows-amd64.exe"
@echo "--> Release is at https://bintray.com/${BINTRAY_USER}/${BINTRAY_REPO}/${BINTRAY_PACKAGE}/${BINTRAY_VERSION}"