Skip to content

Commit d4e5a5b

Browse files
committed
fix: only push image on push event
At the moment push can not be done on pull_request due to forked repo context execution. Do not have rights to access ghcr on the upstream repo. This commit checks if event is push to push the images to ghcr Signed-off-by: Adrian Riobo <ariobolo@redhat.com>
1 parent d7e5a2c commit d4e5a5b

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

.github/workflows/build.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,21 @@ jobs:
3434
username: ${{ github.actor }}
3535
password: ${{ secrets.GITHUB_TOKEN }}
3636

37-
- name: Build and push image (${{ matrix.arch }})
37+
- name: Build image (${{ matrix.arch }})
3838
env:
3939
IMAGE_TAG: ${{ env.IMAGE_TAG }}-${{ matrix.arch }}
4040
run: |
4141
make oci-build
42+
43+
- name: Push image (${{ matrix.arch }})
44+
if: github.event_name == 'push'
45+
env:
46+
IMAGE_TAG: ${{ env.IMAGE_TAG }}-${{ matrix.arch }}
47+
run: |
4248
make oci-push
4349
4450
manifest:
51+
if: github.event_name == 'push'
4552
needs: build
4653
runs-on: ubuntu-24.04
4754

@@ -62,7 +69,6 @@ jobs:
6269
make oci-manifest-push
6370
6471
- name: Tag as latest (main branch only)
65-
if: github.event_name == 'push'
6672
run: |
6773
make oci-tag
6874
make oci-push

0 commit comments

Comments
 (0)