From 0d8d5059c85abef0befd45626d6d08c98a8a3680 Mon Sep 17 00:00:00 2001 From: Brendon Smith Date: Fri, 26 Apr 2024 19:08:30 -0400 Subject: [PATCH] Separate `docker login` and `docker push` https://github.com/pypa/gh-action-pypi-publish/pull/230#discussion_r1578694138 --- .github/workflows/build-and-push-docker-image.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push-docker-image.yml b/.github/workflows/build-and-push-docker-image.yml index 57980fe..d811267 100644 --- a/.github/workflows/build-and-push-docker-image.yml +++ b/.github/workflows/build-and-push-docker-image.yml @@ -22,9 +22,12 @@ jobs: --build-arg BUILDKIT_INLINE_CACHE=1 \ --cache-from $IMAGE \ --tag $IMAGE - - name: Push Docker image to GHCR + - name: Log in to GHCR if: github.event_name != 'pull_request' run: | echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin + - name: Push Docker image to GHCR + if: github.event_name != 'pull_request' + run: | docker push $IMAGE