1
0
Fork 0
mirror of https://github.com/aevea/action-kaniko.git synced 2025-04-20 00:58:15 +02:00

Omit separator if image is pre-fixed with dash or slash

This commit is contained in:
Mikael Elkiaer 2023-01-31 10:35:34 +01:00
parent 0e7f380bca
commit 316d744814

View file

@ -36,7 +36,8 @@ ensure "${CONTEXT_PATH}" "path"
if [ "$REGISTRY" == "ghcr.io" ]; then if [ "$REGISTRY" == "ghcr.io" ]; then
IMAGE_NAMESPACE="$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')" IMAGE_NAMESPACE="$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')"
[ -n "$REPOSITORY" ] && SEPERATOR="/" # Set `/` separator, unless image is pre-fixed with dash or slash
[ -n "$REPOSITORY" ] && [[ ! "$REPOSITORY" =~ ^[-/] ]] && SEPERATOR="/"
export IMAGE="$IMAGE_NAMESPACE$SEPERATOR$IMAGE" export IMAGE="$IMAGE_NAMESPACE$SEPERATOR$IMAGE"
export REPOSITORY="$IMAGE_NAMESPACE$SEPERATOR$REPOSITORY" export REPOSITORY="$IMAGE_NAMESPACE$SEPERATOR$REPOSITORY"