Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃挐 Auto-skip push to registry if secrets are not set #12

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/multiarch-containerfile-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
multiarch-build:
name: Build images
runs-on: ubuntu-22.04
env:
PRINCIPAL: '${{ secrets.QUAY_USER }}:${{ secrets.QUAY_PASSWORD }}'
steps:
- uses: actions/checkout@v2

Expand All @@ -41,8 +43,12 @@ jobs:
echo "Building images from ${GITHUB_REF}@${GITHUB_SHA}"
# Ref: https://regex101.com/r/gcxd4h/1
major_minor="$(echo "$ref" | sed -E 's/^.*?v?([[:digit:]]+)\.([[:digit:]]+).*/\1.\2/')"
echo "container_version=v${major_minor}" >> $GITHUB_OUTPUT
echo "Container version: v${major_minor}"
container_version="${GITHUB_SHA}"
if [[ "$major_minor" != "$ref" ]]; then
container_version="v${major_minor}"
fi
echo "container_version=${container_version}" >> $GITHUB_OUTPUT
echo "Container version: ${container_version}"

- name: Install qemu dependency
run: |
Expand All @@ -60,6 +66,7 @@ jobs:

- name: Push To ${{ inputs.registry }}
id: push-to-quay
if: github.event_name == 'push' && env.PRINCIPAL != ':'
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
Expand Down