Skip to content

Commit

Permalink
@ #1 | fix login gcr with key base64
Browse files Browse the repository at this point in the history
  • Loading branch information
hoatle committed Jan 23, 2022
1 parent d94244d commit 423cf15
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions actions/docker-multiple-login-develop/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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<<EOF" >> $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)
Expand Down

0 comments on commit 423cf15

Please sign in to comment.