Skip to content

Commit

Permalink
Only push to ghcr.io on main forks
Browse files Browse the repository at this point in the history
This should make it possible to build and push images on forks
registries.
  • Loading branch information
fauust committed Aug 24, 2023
1 parent 0d98375 commit fc20968
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/bb_containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,19 @@ jobs:
fi
- name: Login to ghcr.io
uses: docker/login-action@v2
if: (!contains(matrix.dockerfile, 'rhel'))
# this should make it possible to build images in main forks.
if: >
(!contains(matrix.dockerfile, 'rhel')) &&
github.head_ref == 'main'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push images to ghcr.io
if: (!contains(matrix.dockerfile, 'rhel'))
# this should make it possible to build images in main forks.
if: >
(!contains(matrix.dockerfile, 'rhel')) &&
github.head_ref == 'main'
run: |
msg="Push docker image to ghcr.io (${{ env.IMG }})"
line="${msg//?/=}"
Expand Down

0 comments on commit fc20968

Please sign in to comment.