Add snapshot image push

This commit is contained in:
Lars Gohr
2019-08-21 22:23:44 +02:00
parent 545a48203e
commit 5084055330
5 changed files with 45 additions and 10 deletions

View File

@@ -3,7 +3,7 @@
DOCKER_REPOSITORY=$*
BRANCH=$(echo ${GITHUB_REF} | sed -e "s/refs\/heads\///g")
if [ "${BRANCH}" = "master" ]; then
if [ "${BRANCH}" == "master" ]; then
BRANCH="latest"
fi;
@@ -14,5 +14,13 @@ fi;
DOCKERNAME="${DOCKER_REPOSITORY}:${BRANCH}"
docker build -t ${DOCKERNAME} .
docker push ${DOCKERNAME}
if [ "${INPUT_snapshot}" == "true" ]; then
SHA=$(env | grep ^github\\.sha= | cut -d= -f2-) # Thank you Github for using dots in variables
SHA_DOCKER_NAME="${DOCKER_REPOSITORY}:${SHA}"
docker build -t ${DOCKERNAME} -t ${SHA_DOCKER_NAME} .
docker push ${DOCKERNAME}
docker push ${SHA_DOCKER_NAME}
else
docker build -t ${DOCKERNAME} .
docker push ${DOCKERNAME}
fi