Add latest tag to release builds

Fixes #47
This commit is contained in:
Mariano Cano 2019-03-27 11:35:17 -07:00
parent f1dacc6b57
commit 1d022f1f6b

View file

@ -53,10 +53,15 @@ VERSION ?= $(shell [ -d .git ] && git describe --tags --always --dirty="-dev")
# .VERSION contains a slug populated by `git archive`. # .VERSION contains a slug populated by `git archive`.
VERSION := $(or $(VERSION),$(shell ./.version.sh .VERSION)) VERSION := $(or $(VERSION),$(shell ./.version.sh .VERSION))
VERSION := $(shell echo $(VERSION) | sed 's/^v//') VERSION := $(shell echo $(VERSION) | sed 's/^v//')
NOT_RC := $(shell echo $(VERSION) | grep -v -e -rc)
# If TRAVIS_TAG is set then we know this ref has been tagged. # If TRAVIS_TAG is set then we know this ref has been tagged.
ifdef TRAVIS_TAG ifdef TRAVIS_TAG
ifeq ($(NOT_RC),)
PUSHTYPE=release-candidate
else
PUSHTYPE=release PUSHTYPE=release
endif
else else
PUSHTYPE=master PUSHTYPE=master
endif endif
@ -214,24 +219,30 @@ docker-tag:
docker-push-tag: docker-tag docker-push-tag: docker-tag
$(call DOCKER_PUSH,step-ca,$(VERSION)) $(call DOCKER_PUSH,step-ca,$(VERSION))
docker-push-tag-latest:
$(call DOCKER_PUSH,step-ca,latest)
# Rely on DOCKER_USERNAME and DOCKER_PASSWORD being set inside the CI or # Rely on DOCKER_USERNAME and DOCKER_PASSWORD being set inside the CI or
# equivalent environment # equivalent environment
docker-login: docker-login:
$Q docker login -u="$(DOCKER_USERNAME)" -p="$(DOCKER_PASSWORD)" $Q docker login -u="$(DOCKER_USERNAME)" -p="$(DOCKER_PASSWORD)"
.PHONY: docker-login docker-tag docker-push-tag .PHONY: docker-login docker-tag docker-push-tag docker-push-tag-latest
################################################# #################################################
# Targets for pushing the docker images # Targets for pushing the docker images
################################################# #################################################
# For all builds on the master branch, we actually build the container # For all builds that are not tagged
docker-master: docker docker-master: docker
# For all builds on the master branch with an rc tag # For all builds with a release candidate tag
docker-release: docker-master docker-login docker-push-tag docker-release-candidate: docker-master docker-login docker-push-tag
.PHONY: docker-master docker-release # For all builds with a release tag
docker-release: docker-release-candidate docker-push-tag-latest
.PHONY: docker-master docker-release-candidate docker-release
######################################### #########################################
# Debian # Debian
@ -310,10 +321,13 @@ artifacts-tag: artifacts-linux-tag artifacts-darwin-tag
# For all builds that are not tagged # For all builds that are not tagged
artifacts-master: artifacts-master:
# For all build with a release candidate tag
artifacts-release-candidate: artifacts-tag
# For all builds with a release tag # For all builds with a release tag
artifacts-release: artifacts-tag artifacts-release: artifacts-tag
# This command is called by travis directly *after* a successful build # This command is called by travis directly *after* a successful build
artifacts: artifacts-$(PUSHTYPE) docker-$(PUSHTYPE) artifacts: artifacts-$(PUSHTYPE) docker-$(PUSHTYPE)
.PHONY: artifacts-master artifacts-release artifacts .PHONY: artifacts-master artifacts-release-candidate artifacts-release artifacts