Skip to content

Commit

Permalink
Fix registry username & password detection
Browse files Browse the repository at this point in the history
  • Loading branch information
HeroCC committed Oct 23, 2024
1 parent 16e1746 commit 07b091c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/docker-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,16 @@ 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 [ ! -z "${REGISTRY_USERNAME}" && ]; 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
else
echo "REGISTRY_USERNAME=${REGISTRY_USERNAME}" >> $GITHUB_OUTPUT
echo "REGISTRY_PASSWORD=${REGISTRY_PASSWORD}" >> $GITHUB_OUTPUT
echo "REGISTRY_READY=true" >> $GITHUB_OUTPUT
fi
Expand Down

0 comments on commit 07b091c

Please sign in to comment.