Skip to content

Commit 8645216

Browse files
authored
Merge pull request #26 from 0xsequence/version-build-arg
Move the version parameter to build arg
2 parents 8a4df7c + 9ce3ced commit 8645216

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

Dockerfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ WORKDIR /go/src/github.com/0xsequence/waas-authenticator
1414

1515
ADD ./ ./
1616

17-
RUN make build
17+
ARG VERSION
18+
19+
RUN make VERSION=${VERSION} build
1820

1921
#
2022
# Enclave dev image

Makefile

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ TOP := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
44
SHELL = bash -o pipefail
55
TEST_FLAGS ?= -v
66

7-
VERSION := $(shell grep -o 'VERSION = "[^"]*' $(TOP)/version.go | cut -d'"' -f2)
8-
97
define run
108
@go run github.com/goware/rerun/cmd/rerun -watch ./ -ignore vendor bin tests data/schema -run \
119
'GOGC=off go build -o ./bin/$(1) ./cmd/$(1)/main.go && CONFIG=$(CONFIG) ./bin/$(1)'
@@ -24,7 +22,7 @@ define build
2422
go build -v \
2523
-trimpath \
2624
-buildvcs=false \
27-
-ldflags="-s -w -buildid=" \
25+
-ldflags='-X "github.com/0xsequence/waas-authenticator.VERSION=$(VERSION)" -s -w -buildid=' \
2826
-o ./bin/$(1) \
2927
./cmd/$(1)
3028
endef
@@ -56,7 +54,10 @@ test: test-clean
5654
test-clean:
5755
GOGC=off go clean -testcache
5856

59-
eif: clean
57+
eif: ensure-version clean
6058
mkdir -p bin
61-
docker build --platform linux/amd64 --build-arg ENV_ARG=next -t waas-authenticator-builder .
59+
docker build --platform linux/amd64 --build-arg VERSION=$(VERSION) --build-arg ENV_ARG=next -t waas-authenticator-builder .
6260
docker run --platform linux/amd64 -v $(TOP)/bin:/out waas-authenticator-builder waas-auth.$(VERSION)
61+
62+
ensure-version:
63+
test -n "$(VERSION)"

version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package waasauthenticator
22

3-
const VERSION = "v1.0.0-rc.4"
3+
var VERSION = "dev"

0 commit comments

Comments
 (0)