1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-31 01:53:50 +02:00
goreleaser/scripts/entrypoint.sh
Carlos A Becker 5759d7fb92
fix: git safe directory
closes #3233

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2022-08-12 09:42:23 -03:00

33 lines
1.1 KiB
Bash

#!/usr/bin/env bash
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
# prevents git from complaining about unsafe dir, specially when using github actions
git config --global --add safe.directory $PWD
# shellcheck disable=SC2068
exec goreleaser $@