Skip to content

Merge pull request #217 from jmesnil/test #33

Merge pull request #217 from jmesnil/test

Merge pull request #217 from jmesnil/test #33

name: Build and push WildFly Docker images
# This action requires 4 secrets:
# secrets.REGISTRY - the container registry (e.g. quay.io)
# secrets.IMAGE - the namespaced name of the image (e.g. wildfly/wildfly)
# secrets.REGISTRY_USER - the user name to authentication before pushing the image
# secrets.REGISTRY_PASSWORD - the user password to authentication before pushing the image
on:
push:
branches:
- "main"
tags:
- "*"
pull_request:
branches:
- "main"
jobs:
image:
env:
# Put the "latest" tag on this JDK version
JDK_VERSION_FOR_LATEST: 21
IMAGE_TEST: wildfly-test:latest
strategy:
matrix:
include:
- jdk-version: 11
dist: ubi9-minimal
platforms: linux/amd64,linux/arm64,linux/ppc64le
- jdk-version: 17
dist: ubi9-minimal
platforms: linux/amd64,linux/arm64,linux/ppc64le
- jdk-version: 21
dist: ubi9-minimal
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
environment: quay.io
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4.2.0
- name: Docker meta
id: meta
uses: docker/metadata-action@v5.5.1
with:
images: ${{ secrets.REGISTRY }}/${{ secrets.IMAGE }}
flavor: |
latest=false
tags: |
type=ref,event=tag,suffix=-jdk${{ matrix.jdk-version }}
type=raw,value=latest,suffix=-jdk${{ matrix.jdk-version }}
type=raw,value=latest,enable=${{ matrix.jdk-version == env.JDK_VERSION_FOR_LATEST }}
labels: |
org.opencontainers.image.jdk-version=${{ matrix.jdk-version }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.6.1
- name: Build WildFly images
id: docker_build
uses: docker/build-push-action@v6.7.0
with:
load: true
tags: ${{ env.IMAGE_TEST }}
- name: Smoke Test
run: |
./scripts/smoke-test.sh ${{ env.IMAGE_TEST }}
- name: Docker Login to Quay.io
if: startsWith(github.event.ref, 'refs/tags/')
uses: docker/login-action@v3.3.0
with:
registry: ${{ secrets.REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Push WildFly images to container registry
# Only push to the container registry when a new tag is pushed to the repository
id: docker_push
if: startsWith(github.event.ref, 'refs/tags/')
uses: docker/build-push-action@v6.7.0
with:
push: true
platforms: ${{ matrix.platforms }}
build-args: |
jdk=${{ matrix.jdk-version }}
dist=${{ matrix.dist }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}