Skip to content

Commit

Permalink
Add semver to node makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
pschork committed May 11, 2024
1 parent 073ba2e commit e5a5d24
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions node/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
GITCOMMIT := $(shell git rev-parse --short HEAD)
GITDATE := $(shell git log -1 --format=%cd --date=unix)

# GitVersion provides the semantic versioning for the project
SEMVER := $(shell docker run --rm --volume "${PWD}/../:/repo" gittools/gitversion:5.12.0 /repo -output json -showvariable SemVer)
ifeq ($(SEMVER), )
SEMVER = "v0.0.0"
endif

build: clean
go mod tidy
go build -o ./bin/node ./cmd
Expand All @@ -8,7 +17,10 @@ clean:
docker: docker-node docker-plugin

docker-node:
cd ../ && docker build . -t opr-node -f node/cmd/Dockerfile
cd ../ && docker build --build-arg SEMVER=${SEMVER} --build-arg GITCOMMIT=${GITCOMMIT} --build-arg GITDATE=${GITDATE} . -t opr-node:${SEMVER} -t opr-node:latest -f node/cmd/Dockerfile

docker-node-plugin:
cd ../ && docker build --build-arg SEMVER=${SEMVER} --build-arg GITCOMMIT=${GITCOMMIT} --build-arg GITDATE=${GITDATE} . -t opr-nodeplugin:${SEMVER} -t opr-nodeplugin:latest -f node/plugin/cmd/Dockerfile

docker-plugin:
cd ../ && docker build . -t opr-nodeplugin -f node/plugin/cmd/Dockerfile
semver:
echo "${SEMVER}"

0 comments on commit e5a5d24

Please sign in to comment.