Skip to content

Commit 9b2180b

Browse files
authored
Adding condition before pushing the newly built image ...
1 parent 7fa6030 commit 9b2180b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ jobs:
2626
run: docker build docker --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
2727

2828
- name: Log into registry
29+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
2930
run: echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
3031

3132
- name: Push image
33+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
3234
run: |
3335
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
3436

0 commit comments

Comments
 (0)