Build and Push Image #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Image | |
on: | |
workflow_run: | |
workflows: ["Java Maven build"] | |
types: | |
- completed | |
env: | |
IMAGE_NAME: claire | |
IMAGE_REGISTRY: quay.io | |
IMAGE_NAMESPACE: rhmessagingqe | |
ARCHS: amd64, arm64, ppc64le, s390x | |
jobs: | |
build_image: | |
name: Build and push image | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up a cache for Maven | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
- name: Build Image | |
id: build-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: ${{ env.IMAGE_NAME }} | |
tags: latest ${{ github.sha }} ${{ github.ref_name }} | |
archs: ${{ env.ARCHS }} | |
containerfiles: | | |
./Containerfile | |
- name: Push To quay.io | |
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.IMAGE_REGISTRY }}/${{ env.IMAGE_NAMESPACE }} | |
username: ${{ secrets.QUAY_USER }} | |
password: ${{ secrets.QUAY_TOKEN }} | |
- name: Print images URL | |
run: echo "Images pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" |