Merge pull request #223 from jboss-dockerfiles/dependabot/github_acti… #47
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 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: | |
test: | |
# Only build linux/amd64 images for testing | |
env: | |
IMAGE_TEST: wildfly-test:latest | |
strategy: | |
matrix: | |
include: | |
- jdk-version: 11 | |
dist: ubi9-minimal | |
platforms: linux/amd64 | |
- jdk-version: 17 | |
dist: ubi9-minimal | |
platforms: linux/amd64 | |
- jdk-version: 21 | |
dist: ubi9-minimal | |
platforms: linux/amd64 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/[email protected] | |
- name: Set up QEMU | |
uses: docker/[email protected] | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Build WildFly images | |
id: docker_build | |
uses: docker/[email protected] | |
with: | |
load: true | |
tags: ${{ env.IMAGE_TEST }} | |
build-args: | | |
jdk=${{ matrix.jdk-version }} | |
dist=${{ matrix.dist }} | |
- name: Smoke Test | |
run: | | |
./scripts/smoke-test.sh ${{ env.IMAGE_TEST }} | |
# Push to the container registry only when a new tag is pushed | |
push: | |
needs: test | |
environment: quay.io | |
if: startsWith(github.event.ref, 'refs/tags/') | |
env: | |
# Put the "latest" tag on this JDK version | |
JDK_VERSION_FOR_LATEST: 21 | |
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 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/[email protected] | |
- name: Docker meta | |
id: meta | |
uses: docker/[email protected] | |
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/[email protected] | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Docker Login to Quay.io | |
if: startsWith(github.event.ref, 'refs/tags/') | |
uses: docker/[email protected] | |
with: | |
registry: ${{ secrets.REGISTRY }} | |
username: ${{ secrets.REGISTRY_USER }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Push WildFly images to container registry | |
id: docker_push | |
uses: docker/[email protected] | |
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 }} |