diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index eaf9240..99a8c4d 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -19,6 +19,8 @@ jobs: - name: Set version from tag if: startsWith(github.ref, 'refs/tags/v') run: echo ::set-env name=VERSION::$(echo ${GITHUB_REF#refs/tags/}) + - name: Set binary version from Git + run: echo ::set-env name=BINARY_VERSION::$(git describe --tags --always --dirty --match=v*) - name: Build Image run: make docker env: @@ -29,4 +31,4 @@ jobs: name: "${{ env.IMAGE }}:${{ env.VERSION }}" username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - buildargs: VERSION + buildargs: BINARY_VERSION diff --git a/Dockerfile b/Dockerfile index b9693cd..518efa7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ ##################### FROM golang:1.14 as builder -ARG VERSION +ARG BINARY_VERSION # Workdir must be outside of GOPATH because of go mod usage WORKDIR /src/signalilo diff --git a/Makefile b/Makefile index e5c1134..9e9a73c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ # Project parameters BINARY_NAME ?= signalilo -VERSION ?= $(shell git describe --tags --always --dirty --match=v* || (echo "command failed $$?"; exit 1)) +BINARY_VERSION = $(shell git describe --tags --always --dirty --match=v* || (echo "command failed $$?"; exit 1)) +VERSION ?= $(BINARY_VERSION) IMAGE_NAME ?= docker.io/vshn/$(BINARY_NAME):$(VERSION)