mirror of
https://github.com/elgohr/Publish-Docker-Github-Action.git
synced 2026-03-12 18:07:12 -04:00
Looks like git is capitalizing the environment variables. So lets shout when build.
This commit is contained in:
@@ -15,12 +15,12 @@ fi;
|
||||
DOCKERNAME="${DOCKER_REPOSITORY}:${BRANCH}"
|
||||
CUSTOMDOCKERFILE=""
|
||||
|
||||
if [ ! -z "${INPUT_dockerfile}" ]; then
|
||||
CUSTOMDOCKERFILE="-f ${INPUT_dockerfile}"
|
||||
if [ ! -z "${INPUT_DOCKERFILE}" ]; then
|
||||
CUSTOMDOCKERFILE="-f ${INPUT_DOCKERFILE}"
|
||||
fi
|
||||
|
||||
|
||||
if [ "${INPUT_snapshot}" == "true" ]; then
|
||||
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 $CUSTOMDOCKERFILE -t ${DOCKERNAME} -t ${SHA_DOCKER_NAME} .
|
||||
|
||||
12
test.sh
12
test.sh
@@ -1,8 +1,8 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
function cleanEnvironment() {
|
||||
unset INPUT_snapshot
|
||||
unset INPUT_dockerfile
|
||||
unset INPUT_SNAPSHOT
|
||||
unset INPUT_DOCKERFILE
|
||||
}
|
||||
|
||||
function itPushesMasterBranchToLatest() {
|
||||
@@ -43,7 +43,7 @@ Called mock with: push my/repository:latest"
|
||||
|
||||
function itPushesSpecificDockerfileReleasesToLatest() {
|
||||
export GITHUB_REF='refs/tags/myRelease'
|
||||
export INPUT_dockerfile='MyDockerFileName'
|
||||
export INPUT_DOCKERFILE='MyDockerFileName'
|
||||
local result=$(exec /entrypoint.sh 'my/repository')
|
||||
local expected="Called mock with: build -f MyDockerFileName -t my/repository:latest .
|
||||
Called mock with: push my/repository:latest"
|
||||
@@ -57,7 +57,7 @@ Called mock with: push my/repository:latest"
|
||||
|
||||
function itPushesBranchByShaInAddition() {
|
||||
export GITHUB_REF='refs/tags/myRelease'
|
||||
export INPUT_snapshot='true'
|
||||
export INPUT_SNAPSHOT='true'
|
||||
local result=$(exec env 'github.sha'=COMMIT_SHA /entrypoint.sh 'my/repository')
|
||||
local expected="Called mock with: build -t my/repository:latest -t my/repository:COMMIT_SHA .
|
||||
Called mock with: push my/repository:latest
|
||||
@@ -72,8 +72,8 @@ Called mock with: push my/repository:COMMIT_SHA"
|
||||
|
||||
function itPushesBranchByShaInAdditionWithSpecificDockerfile() {
|
||||
export GITHUB_REF='refs/tags/myRelease'
|
||||
export INPUT_snapshot='true'
|
||||
export INPUT_dockerfile='MyDockerFileName'
|
||||
export INPUT_SNAPSHOT='true'
|
||||
export INPUT_DOCKERFILE='MyDockerFileName'
|
||||
local result=$(exec env 'github.sha'=COMMIT_SHA /entrypoint.sh 'my/repository')
|
||||
local expected="Called mock with: build -f MyDockerFileName -t my/repository:latest -t my/repository:COMMIT_SHA .
|
||||
Called mock with: push my/repository:latest
|
||||
|
||||
Reference in New Issue
Block a user