From 1506f836af26a2682ffc6c9faf71eb86cfee8842 Mon Sep 17 00:00:00 2001 From: Conlan Cesar Date: Tue, 22 Oct 2024 21:53:53 -0400 Subject: [PATCH] Fix registry username & password detection --- .github/workflows/docker-publish.yaml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 3155c9e3e..5b025b164 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -167,15 +167,17 @@ jobs: id: credentials run: | # Write the username and password to job outputs - echo "REGISTRY_USERNAME=${{ secrets[format('REGISTRY_USERNAME_{0}', steps.prepare.outputs.REGISTRY)] }}" >> $GITHUB_OUTPUT - echo "REGISTRY_PASSWORD=${{ secrets[format('REGISTRY_PASSWORD_{0}', steps.prepare.outputs.REGISTRY)] }}" >> $GITHUB_OUTPUT + REGISTRY_USERNAME=${{ secrets[format('REGISTRY_USERNAME_{0}', steps.prepare.outputs.REGISTRY)] }} + REGISTRY_PASSWORD=${{ secrets[format('REGISTRY_PASSWORD_{0}', steps.prepare.outputs.REGISTRY)] }} - if [ ! -s $GITHUB_OUTPUT ]; then + if [ -n "${REGISTRY_USERNAME}" && -n "${REGISTRY_PASSWORD}" ]; then # If we don't have the relevant credentials, we can't push. Warn the user, but don't fail. echo "::warning::Pushing to ${{ matrix.registry }} is disabled; we can't find credentials" - echo "REGISTRY_READY=false" >> $GITHUB_OUTPUT + echo "REGISTRY_READY=false" | tee -a $GITHUB_OUTPUT else - echo "REGISTRY_READY=true" >> $GITHUB_OUTPUT + echo "REGISTRY_USERNAME=${REGISTRY_USERNAME}" >> $GITHUB_OUTPUT + echo "REGISTRY_PASSWORD=${REGISTRY_PASSWORD}" >> $GITHUB_OUTPUT + echo "REGISTRY_READY=true" | tee -a $GITHUB_OUTPUT fi - name: Set up Docker Buildx