Skip to content

Add build-images workflow #2

Add build-images workflow

Add build-images workflow #2

Workflow file for this run

name: Build and Publish Images
on:
push:
branches:
- main
- "release-*"
- "gh-actions-*"
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:
env:
IMG_TAGS: ${{ github.sha }}
IMG_REGISTRY_HOST: quay.io
IMG_REGISTRY_ORG: kuadrant
IMG_REGISTRY_REPO: kuadrant-dns-operator
IMG_REGISTRY_REPO_BUNDLE: kuadrant-dns-operator-bundle
IMG_REGISTRY_REPO_CATALOG: kuadrant-dns-operator-catalog
MAIN_BRANCH_NAME: main
OPERATOR_NAME: kuadrant-dns-operator
jobs:
build:
# if: github.repository_owner == 'kuadrant'
name: Build and Push image
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Add latest tag
if: ${{ github.ref_name == env.MAIN_BRANCH_NAME }}
id: add-latest-tag
run: |
echo "IMG_TAGS=latest ${{ env.IMG_TAGS }}" >> $GITHUB_ENV
- name: Build Image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.OPERATOR_NAME }}
tags: ${{ env.IMG_TAGS }}
dockerfiles: |
./Dockerfile
- name: Print Build Info
run: echo "Image - ${{ steps.build-image.outputs.image }}, Tags - ${{ steps.build-image.outputs.tags }}"
# - name: Push Image
# if: ${{ !env.ACT }}
# id: push-to-quay
# uses: redhat-actions/push-to-registry@v2
# with:
# image: ${{ steps.build-image.outputs.image }}
# tags: ${{ steps.build-image.outputs.tags }}
# registry: ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}
# username: ${{ secrets.IMG_REGISTRY_USERNAME }}
# password: ${{ secrets.IMG_REGISTRY_TOKEN }}
# - name: Print Image URL
# run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"