From 30ecd1c701d15fd3a8c2a3ce28baccba530b64ce Mon Sep 17 00:00:00 2001
From: Christoph Witzko <github@christophwitzko.com>
Date: Sun, 26 Apr 2020 12:40:36 +0200
Subject: [PATCH] feat: push docker image to gitlab registry

---
 .github/workflows/ci.yml |  2 ++
 scripts/release          | 11 ++++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 32119db..5f037f9 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -70,4 +70,6 @@ jobs:
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
           NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
+          GITLAB_USER: ${{ secrets.GITLAB_USER }}
+          GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
         run: ./scripts/release || exit 0
diff --git a/scripts/release b/scripts/release
index f0d3822..bf081e7 100755
--- a/scripts/release
+++ b/scripts/release
@@ -14,14 +14,23 @@ ghr $(cat .ghr) bin/
 # docker build
 export IMAGE_NAME="docker.pkg.github.com/go-semantic-release/semantic-release/semantic-release"
 export IMAGE_NAME_VERSION="$IMAGE_NAME:$VERSION"
+export GL_IMAGE_NAME="registry.gitlab.com/go-semantic-release/semantic-release"
+export GL_IMAGE_NAME_VERSION="$GL_IMAGE_NAME:$VERSION"
 
 docker build --build-arg VERSION=$VERSION -t $IMAGE_NAME_VERSION .
 docker tag $IMAGE_NAME_VERSION $IMAGE_NAME
+docker tag $IMAGE_NAME_VERSION $GL_IMAGE_NAME
+docker tag $IMAGE_NAME_VERSION $GL_IMAGE_NAME_VERSION
 
-# push to docker hub
+# push to GitHub Docker Registry
 docker login docker.pkg.github.com -u $GITHUB_ACTOR -p $GITHUB_TOKEN
 docker push $IMAGE_NAME_VERSION
 docker push $IMAGE_NAME
 
+# push to GitLab Docker Registry
+docker login registry.gitlab.com -u $GITLAB_USER -p $GITLAB_TOKEN
+docker push $GL_IMAGE_NAME_VERSION
+docker push $GL_IMAGE_NAME
+
 # publish npm package
 cd ./npm-package && npm publish
-- 
GitLab