From e1c16e971a91bc55c9006627f08d81e454d16f8e Mon Sep 17 00:00:00 2001 From: Michael Nairn Date: Fri, 2 Feb 2024 17:30:15 +0000 Subject: [PATCH] Add build-images workflow --- .github/workflows/build-images.yaml | 60 ++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-images.yaml b/.github/workflows/build-images.yaml index 59eb6100..8fd46aca 100644 --- a/.github/workflows/build-images.yaml +++ b/.github/workflows/build-images.yaml @@ -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 @@ -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 @@ -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 @@ -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