From c8a4d22a61fc706e7fc9d313f270b5541c12a73f Mon Sep 17 00:00:00 2001 From: Steve Sloka Date: Mon, 14 Sep 2020 20:24:59 -0400 Subject: [PATCH] ci: Update github action to push docker image tagged with sha for each merge to master branch Updates the github action to also push a tagged image based upon the git sha. The tag also includes the current version of the release. Example tag: envoyproxy/ratelimit:f1758150b6dfed3e5c0ae13fb7bb6b8f6ae00b0e Fixes #174 Signed-off-by: Steve Sloka --- .github/workflows/master.yaml | 6 +++--- Makefile | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/master.yaml b/.github/workflows/master.yaml index a3bd5867..c05970a6 100644 --- a/.github/workflows/master.yaml +++ b/.github/workflows/master.yaml @@ -20,8 +20,8 @@ jobs: - name: build and push docker image run: | echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - make docker_push + VERSION=master make docker_push # Push image tagged with "master" + make docker_push # Push image tagged with git sha env: DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - VERSION: master \ No newline at end of file + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} \ No newline at end of file diff --git a/Makefile b/Makefile index b66a67a7..0b3d5b84 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ REGISTRY ?= envoyproxy IMAGE := $(REGISTRY)/$(PROJECT) INTEGRATION_IMAGE := $(REGISTRY)/$(PROJECT)_integration MODULE = github.com/envoyproxy/ratelimit -GIT_REF = $(shell git describe --tags || git rev-parse --short=8 --verify HEAD) +GIT_REF = $(shell git describe --tags --exact-match 2>/dev/null || git rev-parse --short=8 --verify HEAD) VERSION ?= $(GIT_REF) SHELL := /bin/bash