2018-09-04 14:19:01 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-09-04 16:17:35 +02:00
|
|
|
if [ -n "$DOCKER_USERNAME" ] && [ -n "$DOCKER_PASSWORD" ]; then
|
2020-09-06 15:16:53 +02:00
|
|
|
echo "Login to the docker..."
|
|
|
|
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin "$DOCKER_REGISTRY"
|
2018-09-04 14:19:01 +02:00
|
|
|
fi
|
|
|
|
|
2019-03-14 14:13:12 +02:00
|
|
|
# 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
|
2020-09-06 15:16:53 +02:00
|
|
|
export GITHUB_TOKEN=$GORELEASER_GITHUB_TOKEN
|
2019-03-14 14:13:12 +02:00
|
|
|
fi
|
|
|
|
|
2020-08-06 20:08:05 +02:00
|
|
|
if [ -n "$GITHUB_TOKEN" ]; then
|
2020-09-06 15:16:53 +02:00
|
|
|
# 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
|
2020-08-06 20:08:05 +02:00
|
|
|
fi
|
|
|
|
|
2022-08-08 03:39:03 +02:00
|
|
|
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
|
2022-08-12 14:42:23 +02:00
|
|
|
git config --global --add safe.directory $PWD
|
2022-07-07 04:48:17 +02:00
|
|
|
|
2020-09-06 15:16:53 +02:00
|
|
|
# shellcheck disable=SC2068
|
2021-09-27 16:57:41 +02:00
|
|
|
exec goreleaser $@
|