Add docker login and logout, due to the data is not passed from the previous step. Remove old workflow, as it's not backward compatible. Use name instead of args for the image name

This commit is contained in:
Lars Gohr
2019-08-22 22:07:56 +02:00
parent 964b205576
commit 505b28d941
4 changed files with 101 additions and 67 deletions

View File

@@ -1,6 +1,5 @@
#!/bin/sh
DOCKER_REPOSITORY=$*
BRANCH=$(echo ${GITHUB_REF} | sed -e "s/refs\/heads\///g")
if [ "${BRANCH}" == "master" ]; then
@@ -12,16 +11,17 @@ if [ $(echo ${GITHUB_REF} | sed -e "s/refs\/tags\///g") != ${GITHUB_REF} ]; then
BRANCH="latest"
fi;
DOCKERNAME="${DOCKER_REPOSITORY}:${BRANCH}"
DOCKERNAME="${INPUT_NAME}:${BRANCH}"
CUSTOMDOCKERFILE=""
if [ ! -z "${INPUT_DOCKERFILE}" ]; then
CUSTOMDOCKERFILE="-f ${INPUT_DOCKERFILE}"
fi
docker login -u ${INPUT_USERNAME} -p ${INPUT_PASSWORD} ${INPUT_REGISTRY}
if [ "${INPUT_SNAPSHOT}" == "true" ]; then
SHA_DOCKER_NAME="${DOCKER_REPOSITORY}:${GITHUB_SHA}"
SHA_DOCKER_NAME="${INPUT_NAME}:${GITHUB_SHA}"
docker build $CUSTOMDOCKERFILE -t ${DOCKERNAME} -t ${SHA_DOCKER_NAME} .
docker push ${DOCKERNAME}
docker push ${SHA_DOCKER_NAME}
@@ -29,3 +29,5 @@ else
docker build $CUSTOMDOCKERFILE -t ${DOCKERNAME} .
docker push ${DOCKERNAME}
fi
docker logout