diff --git a/action.yml b/action.yml index 81a8c0d..259c457 100644 --- a/action.yml +++ b/action.yml @@ -108,6 +108,20 @@ runs: cache_scope="image-$(printf '%s' "$INPUTS_IMAGE" | sha256sum | cut -c1-16)" echo "cache_scope=$cache_scope" >> "$GITHUB_OUTPUT" + - name: Login to ${{ steps.image.outputs.registry }} + uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0 + if: ${{ inputs.username != '' && inputs.password != '' }} + with: + registry: ${{ steps.image.outputs.registry }} + username: ${{ inputs.username }} + password: ${{ inputs.password }} + + - name: ACR Login + if: ${{ contains(steps.image.outputs.registry , '.azurecr.io') && inputs.password == ''}} + shell: bash + env: + STEPS_IMAGE_OUTPUTS_REGISTRY: ${{ steps.image.outputs.registry }} + run: az acr login --name ${STEPS_IMAGE_OUTPUTS_REGISTRY} - name: Build image (local load for scanning) uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 @@ -157,21 +171,6 @@ runs: done <<< "$IMAGE_TAGS" rm -rf /tmp/docker-scout "$HOME/.cache/java-db" "$HOME/.docker/scout" - - name: Login to ${{ steps.image.outputs.registry }} - uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0 - if: ${{ inputs.username != '' && inputs.password != '' }} - with: - registry: ${{ steps.image.outputs.registry }} - username: ${{ inputs.username }} - password: ${{ inputs.password }} - - - name: ACR Login - if: ${{ contains(steps.image.outputs.registry , '.azurecr.io') }} - shell: bash - env: - STEPS_IMAGE_OUTPUTS_REGISTRY: ${{ steps.image.outputs.registry }} - run: az acr login --name ${STEPS_IMAGE_OUTPUTS_REGISTRY} - - name: Push image with attestations uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 with: