-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
81 lines (67 loc) · 2.12 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
export GO111MODULE = on
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
COMMIT := $(shell git log -1 --format='%H' | cut -c 1-8)
# don't override user values
ifeq (,$(VERSION))
VERSION := $(shell git describe --tags)
# if VERSION is empty, then populate it with branch's name and raw commit hash
ifeq (,$(VERSION))
VERSION := $(BRANCH)-$(COMMIT)
endif
endif
ldflags = -X github.com/dymensionxyz/eibc-client/version.BuildVersion=$(VERSION)
BUILD_FLAGS := -ldflags '$(ldflags)'
###########
# Install #
###########
all: install
.PHONY: install
install: build
@echo "--> installing eibc-client"
mv build/eibc-client $(GOPATH)/bin/eibc-client
.PHONY: build
build: go.sum ## Compiles the eibc binary
@echo "--> Ensure dependencies have not been modified"
@go mod verify
@echo "--> building eibc-client"
@go build -o build/eibc-client $(BUILD_FLAGS) ./
###########
# Docker #
###########
.PHONY: docker-build
docker-build:
@echo "--> Building Docker image"
docker build -t eibc-client:latest .
###############################################################################
### Releasing ###
###############################################################################
PACKAGE_NAME:=github.com/dymensionxyz/eibc-client
GOLANG_CROSS_VERSION = v1.23
GOPATH ?= '$(HOME)/go'
release-dry-run:
docker run \
--rm \
--privileged \
-e CGO_ENABLED=1 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-v ${GOPATH}/pkg:/go/pkg \
-w /go/src/$(PACKAGE_NAME) \
ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
--clean --skip=validate --skip=publish --snapshot
release:
@if [ ! -f ".release-env" ]; then \
echo "\033[91m.release-env is required for release\033[0m";\
exit 1;\
fi
docker run \
--rm \
--privileged \
-e CGO_ENABLED=1 \
--env-file .release-env \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \
ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
release --clean --skip=validate
.PHONY: release-dry-run release