Skip to content

Commit 6ee4669

Browse files
committed
Adding condition before pushing the newly built image (1)...
1 parent 9b2180b commit 6ee4669

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ jobs:
2727

2828
- name: Log into registry
2929
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
30-
run: echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
30+
run: |
31+
if [ -z "${{ secrets.GHCR_PAT }}" ]; then
32+
echo "GHCR_PAT is not set or unavailable in this context"
33+
exit 1
34+
fi
35+
echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
3136
3237
- name: Push image
3338
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
@@ -45,4 +50,4 @@ jobs:
4550
echo IMAGE_ID=$IMAGE_ID
4651
echo VERSION=$VERSION
4752
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
48-
docker push $IMAGE_ID:$VERSION
53+
docker push $IMAGE_ID:$VERSION

0 commit comments

Comments
 (0)