generated from forta-network/go-bot-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
69 lines (52 loc) · 2.06 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
.PHONY: build push-dev push publish-dev publish tag tag-dev
TS := $(shell /bin/date "+%s")
TAG = etherscan-labeler-${TS}:latest
DEV_REPO = disco-dev.forta.network
REPO = disco.forta.network
test:
go test ./...
build-cli:
rm -f publish-cli
wget https://github.com/forta-network/go-bot-publish-cli/releases/download/v0.0.1/publish-cli
chmod 755 publish-cli
publish-manifest-dev: build-cli
$(eval manifest = $(shell ./publish-cli publish --manifest manifest-template.json --env dev))
@echo ${manifest}
publish-manifest-prod: build-cli
$(eval manifest = $(shell ./publish-cli publish --manifest manifest-template.json --env prod))
@echo ${manifest}
build:
@docker build -t ${TAG} .
sleep 3
init-id:
@./publish-cli generate-id
$(eval botId = $(shell cat ./.settings/botId))
@echo publishing ${botId}
tag-dev: build
docker tag ${TAG} ${DEV_REPO}/${TAG}
tag: build
docker tag ${TAG} ${REPO}/${TAG}
push-dev: init-id
$(eval imageDigest = $(shell docker push ${DEV_REPO}/${TAG} | grep -E -o '[0-9a-f]{64}'))
$(eval cid = $(shell docker pull -a ${DEV_REPO}/${imageDigest} | grep -E -o 'bafy[0-9a-z]+'))
@echo ${cid}@sha256:${imageDigest}
$(eval manifest = $(shell ./publish-cli publish-metadata --image ${cid}@sha256:${imageDigest} --doc-file docs/README.md --env dev))
@echo "pushed metadata to dev: ${manifest}"
./publish-cli publish --manifest ${manifest} --env dev
push: init-id
$(eval imageDigest = $(shell docker push ${REPO}/${TAG} | grep -E -o '[0-9a-f]{64}'))
$(eval cid = $(shell docker pull -a ${REPO}/${imageDigest} | grep -E -o 'bafy[0-9a-z]+'))
@echo ${cid}@sha256:${imageDigest}
$(eval manifest = $(shell ./publish-cli publish-metadata --image ${cid}@sha256:${imageDigest} --doc-file docs/README.md --env prod))
@echo "pushed metadata to prod: ${manifest}"
./publish-cli publish --manifest ${manifest} --env prod --gas-price 250
disable-dev:
./publish-cli disable --env dev
disable:
./publish-cli disable --env prod
enable-dev:
./publish-cli enable --env dev
enable:
./publish-cli enable --env prod
publish-dev: build tag-dev push-dev
publish: build tag push