Skip to content

Commit

Permalink
move version parameter to build arg
Browse files Browse the repository at this point in the history
  • Loading branch information
patrislav committed Feb 27, 2024
1 parent f51fa38 commit 9ce3ced
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ WORKDIR /go/src/github.com/0xsequence/waas-authenticator

ADD ./ ./

RUN make build
ARG VERSION

RUN make VERSION=${VERSION} build

#
# Enclave dev image
Expand Down
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ TOP := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
SHELL = bash -o pipefail
TEST_FLAGS ?= -v

VERSION := $(shell grep -o 'VERSION = "[^"]*' $(TOP)/version.go | cut -d'"' -f2)

define run
@go run github.com/goware/rerun/cmd/rerun -watch ./ -ignore vendor bin tests data/schema -run \
'GOGC=off go build -o ./bin/$(1) ./cmd/$(1)/main.go && CONFIG=$(CONFIG) ./bin/$(1)'
Expand All @@ -24,7 +22,7 @@ define build
go build -v \
-trimpath \
-buildvcs=false \
-ldflags="-s -w -buildid=" \
-ldflags='-X "github.com/0xsequence/waas-authenticator.VERSION=$(VERSION)" -s -w -buildid=' \
-o ./bin/$(1) \
./cmd/$(1)
endef
Expand Down Expand Up @@ -56,7 +54,10 @@ test: test-clean
test-clean:
GOGC=off go clean -testcache

eif: clean
eif: ensure-version clean
mkdir -p bin
docker build --platform linux/amd64 --build-arg ENV_ARG=next -t waas-authenticator-builder .
docker build --platform linux/amd64 --build-arg VERSION=$(VERSION) --build-arg ENV_ARG=next -t waas-authenticator-builder .
docker run --platform linux/amd64 -v $(TOP)/bin:/out waas-authenticator-builder waas-auth.$(VERSION)

ensure-version:
test -n "$(VERSION)"
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package waasauthenticator

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

0 comments on commit 9ce3ced

Please sign in to comment.