Skip to content

🐛 fixing the two image push #26

🐛 fixing the two image push

🐛 fixing the two image push #26

name: Development Build
# Workflow builds and pushes detector images to Quay.io
# Image naming convention:
# ${REGISTRY}/${ORG_PREFIX}/${IMAGE_PREFIX}/${TAG_PREFIX}:${TAG}
# Example: quay.io/rh-ee-mmisiura/guardrails-detectors/hf-detector:dev-abc123
#
# To add a new detector:
# 1. Add new entry to matrix.detector:
# - name: your-detector-name
# dockerfile: Dockerfile.your-detector
# context: detectors
# tag_prefix: your-detector-prefix
# 2. Images will be tagged as:
# - :dev (latest development version)
# - :dev-{SHA} (specific commit version)
# 3. Push to 'dev' branch to trigger the workflow
on:
push:
branches:
- 'dev'
- 'gh_workflows'
env:
REGISTRY: quay.io
ORG_PREFIX: rh-ee-mmisiura
IMAGE_PREFIX: ${{ github.event.repository.name }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
detector:
# active detector configuration
- name: huggingface
dockerfile: Dockerfile.hf
context: detectors
tag_prefix: hf-detector
# template for future detectors -- uncomment and modify as needed
# - name: custom
# dockerfile: Dockerfile.custom
# context: detectors
# tag_prefix: custom-detector
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Podman
run: |
sudo apt-get update
sudo apt-get install -y podman
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Build and push
run: |
# IMAGE_TAG="${REGISTRY}/${ORG_PREFIX}/${IMAGE_PREFIX}/${{ matrix.detector.tag_prefix }}:dev"
# echo "Building ${IMAGE_TAG}"
# podman build \
# --platform linux/amd64 \
# -f ${{ matrix.detector.context }}/${{ matrix.detector.dockerfile }} \
# -t ${IMAGE_TAG} \
# ${{ matrix.detector.context }}
# echo "Pushing ${IMAGE_TAG}"
# podman push ${IMAGE_TAG}
# Get short SHA
SHA=$(git rev-parse --short HEAD)
# Define tags
IMAGE_BASE="${REGISTRY}/${ORG_PREFIX}/${IMAGE_PREFIX}/${{ matrix.detector.tag_prefix }}"
IMAGE_TAG_SHA="${IMAGE_BASE}:dev-${SHA}"
echo "Building ${IMAGE_TAG_DEV} and ${IMAGE_TAG_SHA}"
podman build \
--platform linux/amd64 \
-f ${{ matrix.detector.context }}/${{ matrix.detector.dockerfile }} \
-t ${IMAGE_TAG_SHA} \
${{ matrix.detector.context }}
echo "Pushing tags"
podman push ${IMAGE_TAG_SHA}