Skip to content

Commit

Permalink
Add build-images workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mikenairn committed Feb 2, 2024
1 parent b838801 commit e1c16e9
Showing 1 changed file with 58 additions and 2 deletions.
60 changes: 58 additions & 2 deletions .github/workflows/build-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ env:
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

Expand All @@ -32,11 +30,13 @@ jobs:
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
Expand All @@ -45,8 +45,10 @@ jobs:
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: github.repository_owner == 'kuadrant'
id: push-to-quay
Expand All @@ -57,5 +59,59 @@ jobs:
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 }}"

build-bundle:
name: Build and Push bundle 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 }}-bundle
tags: ${{ env.IMG_TAGS }}
dockerfiles: |
./bundle.Dockerfile
- name: Print Build Info
run: echo "Image = ${{ steps.build-image.outputs.image }}, Tags = ${{ steps.build-image.outputs.tags }}"

- name: Push Image
if: github.repository_owner == 'kuadrant'
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 }}"

build-catalog:
name: Build and Push catalog image
needs: [build, build-bundle]
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

0 comments on commit e1c16e9

Please sign in to comment.