Lars Gohr
2019-09-15 13:20:39 +02:00
parent b9943cee39
commit 073c9a9c0e
2 changed files with 14 additions and 1 deletions

View File

@@ -16,7 +16,7 @@ if [ -z "${INPUT_PASSWORD}" ]; then
exit 1 exit 1
fi fi
BRANCH=$(echo ${GITHUB_REF} | sed -e "s/refs\/heads\///g") BRANCH=$(echo ${GITHUB_REF} | sed -e "s/refs\/heads\///g" | sed -e "s/\//-/g")
if [ "${BRANCH}" = "master" ]; then if [ "${BRANCH}" = "master" ]; then
BRANCH="latest" BRANCH="latest"

View File

@@ -42,6 +42,19 @@ Called mock with: logout"
[ "$output" = "$expected" ] [ "$output" = "$expected" ]
} }
@test "it converts dashes in branch to hyphens" {
export GITHUB_REF='refs/heads/myBranch/withDash'
run /entrypoint.sh
local expected="Called mock with: login -u USERNAME --password-stdin
Called mock with: build -t my/repository:myBranch-withDash .
Called mock with: push my/repository:myBranch-withDash
Called mock with: logout"
echo $output
[ "$output" = "$expected" ]
}
@test "it pushes tags to latest" { @test "it pushes tags to latest" {
export GITHUB_REF='refs/tags/myRelease' export GITHUB_REF='refs/tags/myRelease'