From 423cf15b6636aec735d4f785634b9ea108532ec7 Mon Sep 17 00:00:00 2001 From: hoatle Date: Mon, 24 Jan 2022 00:53:57 +0700 Subject: [PATCH] @ #1 | fix login gcr with key base64 --- .../docker-multiple-login-develop/action.yml | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/actions/docker-multiple-login-develop/action.yml b/actions/docker-multiple-login-develop/action.yml index a23606f..3420fd1 100644 --- a/actions/docker-multiple-login-develop/action.yml +++ b/actions/docker-multiple-login-develop/action.yml @@ -128,14 +128,32 @@ runs: username: ${{ inputs.azure-client-id }} password: ${{ inputs.azure-client-secret }} + # _json_key_base64 is not supported so we must convert it + - name: GCR Keys + if: ${{ inputs.gcr-json-key-base64 }} + run: | + echo "$GCR_JSON_KEY_BASE64" | base64 --decode >> .gcr-key + while read -r line; + do + echo "::add-mask::${line}" + done <<< "$(cat .gcr-key)" + echo "GCR_JSON_KEY<> $GITHUB_ENV + cat .gcr-key >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + # clean up + rm .gcr-key + shell: bash + env: + GCR_JSON_KEY_BASE64: ${{ inputs.gcr-json-key-base64 }} + # https://github.com/docker/login-action#google-container-registry-gcr - name: Login to Google Container Registry (GCR) uses: docker/login-action@v1 if: ${{ inputs.gcr-json-key-base64 }} with: registry: gcr.io - username: _json_key_base64 - password: ${{ inputs.gcr-json-key-base64 }} + username: _json_key + password: ${{ env.GCR_JSON_KEY }} # https://github.com/docker/login-action#google-artifact-registry-gar - name: Login to Google Artifact Registry (GAR)