Skip to content

Commit

Permalink
fix: entrypoint.sh login (#41)
Browse files Browse the repository at this point in the history
closes #40
  • Loading branch information
caarlos0 authored Jul 5, 2023
1 parent 20fbee9 commit 8902db9
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,31 @@ if [[ -f $DOCKER_CREDS_FILE ]]; then
fi
fi

if [ -n "$DOCKER_USERNAME" ] && [ -n "$DOCKER_PASSWORD" ]; then
echo "Login to the docker..."
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin "$DOCKER_REGISTRY"
fi

# Workaround for github actions when access to different repositories is needed.
# Github actions provides a GITHUB_TOKEN secret that can only access the current
# repository and you cannot configure it's value.
# Access to different repositories is needed by brew for example.

if [ -n "$GORELEASER_GITHUB_TOKEN" ] ; then
export GITHUB_TOKEN=$GORELEASER_GITHUB_TOKEN
fi

if [ -n "$GITHUB_TOKEN" ]; then
# Log into GitHub package registry
echo "$GITHUB_TOKEN" | docker login docker.pkg.github.com -u docker --password-stdin
echo "$GITHUB_TOKEN" | docker login ghcr.io -u docker --password-stdin
fi

if [ -n "$CI_REGISTRY_PASSWORD" ]; then
# Log into GitLab registry
echo "$CI_REGISTRY_PASSWORD" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin
fi

git config --global --add safe.directory "$(pwd)"

exec goreleaser "$@"

0 comments on commit 8902db9

Please sign in to comment.