Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

Commit

Permalink
drone: use DRONE_TAG for VERSION if present
Browse files Browse the repository at this point in the history
The way drone checks out, tags are not available for `git describe`.

Additionally, set GO111MODULE=off in Dapper.
  • Loading branch information
dweomer committed May 6, 2020
1 parent 3ed9373 commit afb944f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Expand Up @@ -35,9 +35,11 @@ VOLUME /var/log

# Dapper/Drone/CI environment
FROM build AS dapper
ARG GO111MODULE=off
ARG GOBIN=/opt/k3c/bin
ARG GOPATH=/go
ENV GOBIN=${GOBIN} \
ENV GO111MODULE=${GO111MODULE} \
GOBIN=${GOBIN} \
GOPATH=${GOPATH}
ENV DAPPER_ENV REPO TAG DRONE_TAG
ENV DAPPER_OUTPUT ./bin ./dist
Expand Down
10 changes: 7 additions & 3 deletions Makefile
Expand Up @@ -44,9 +44,13 @@ ifndef GOBIN
GOBIN := bin
endif

VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.dirty' --always --tags)
REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .dirty; fi)
RELEASE=${PROG}-$(VERSION).${GOOS}-${GOARCH}
ifdef DRONE_TAG
VERSION = ${DRONE_TAG}
else
VERSION = $(shell git describe --match 'v[0-9]*' --dirty='.dirty' --always --tags)
endif
REVISION = $(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .dirty; fi)
RELEASE = ${PROG}-${GOOS}-${GOARCH}
ifndef TAG
TAG := $(shell echo "$(VERSION)" | tr '+' '-')-${GOARCH}
endif
Expand Down

0 comments on commit afb944f

Please sign in to comment.