Skip to content

Bump docker/setup-buildx-action from 2 to 3 #184

Bump docker/setup-buildx-action from 2 to 3

Bump docker/setup-buildx-action from 2 to 3 #184

Workflow file for this run

name: build
on:
push:
branches:
- opsexp-[0-9]+**
- OPSEXP-[0-9]+**
- dependabot/**
- master
env:
IMAGE_REGISTRY_NAMESPACE: alfresco
IMAGE_REPOSITORY: alfresco-base-java
jobs:
docker_images:
strategy:
matrix:
base_image:
- flavor: centos
major: 7
- flavor: rockylinux
major: 8
java_major:
- 11
- 17
jdist:
- jre
- jdk
exclude:
- base_image:
flavor: centos
major: 7
java_major: 17
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v3
- id: vars
name: Compute Image Tag
env:
IMAGE_BASE_NAME: ${{ matrix.jdist }}${{ matrix.java_major }}-${{ matrix.base_image.flavor }}${{ matrix.base_image.major }}
run: |
if [[ "${{ github.ref_name }}" != "master" ]]
then
echo "image_tag=${IMAGE_BASE_NAME}-${GITHUB_REF_NAME//\//-}" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.head_commit.message }}" =~ .*\[release\].* ]]
then
echo "image_tag=$IMAGE_BASE_NAME" >> $GITHUB_OUTPUT
else
echo "image_tag=${IMAGE_BASE_NAME}-release-candidate" >> $GITHUB_OUTPUT
fi
echo "image_created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
echo "image_anchor=$(date -u +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT
- name: Login to quay.io
if: github.actor != 'dependabot[bot]'
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Login to docker.io
if: contains(github.event.head_commit.message, '[release]') && github.ref_name == 'master'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Image locally
uses: docker/[email protected]
with:
load: true
build-args: |
no-cache=true
JDIST=${{ matrix.jdist }}
DISTRIB_NAME=${{ matrix.base_image.flavor }}
DISTRIB_MAJOR=${{ matrix.base_image.major }}
JAVA_MAJOR=${{ matrix.java_major }}
REVISION=${{ github.run_number }}
CREATED=${{ steps.vars.outputs.image_created }}
tags: |
local/${{ env.IMAGE_REPOSITORY }}:ci
target: JAVA_BASE_IMAGE
- name: Test Built Image
run: |
echo -n "Checking for java version: "
docker run local/${{ env.IMAGE_REPOSITORY }}:ci java -version 2>&1 \
| grep -i 'version \"${{ matrix.java_major }}\.'
echo -n "Checking shell environment: "
BASH_LOGIN="$(docker run local/${{ env.IMAGE_REPOSITORY }}:ci /bin/bash 2>&1 > /dev/null || true)"
if [ -z "$BASH_LOGIN" ]; then
echo ok
else echo 'bash reported an error'
echo $BASH_LOGIN
exit 7
fi
- name: Build and Push to quay.io
uses: docker/[email protected]
with:
push: ${{ github.actor != 'dependabot[bot]' }}
build-args: |
JDIST=${{ matrix.jdist }}
DISTRIB_NAME=${{ matrix.base_image.flavor }}
DISTRIB_MAJOR=${{ matrix.base_image.major }}
JAVA_MAJOR=${{ matrix.java_major }}
REVISION=${{ github.run_number }}
CREATED=${{ steps.vars.outputs.image_created }}
tags: |
quay.io/${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }}-${{ steps.vars.outputs.image_anchor }}
quay.io/${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }}
platforms: linux/amd64,linux/arm64/v8
target: JAVA_BASE_IMAGE
- name: Push Image to docker.io
if: contains(github.event.head_commit.message, '[release]') && github.ref_name == 'master'
uses: akhilerm/[email protected]
with:
src: quay.io/${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }}-${{ steps.vars.outputs.image_anchor }}
dst: |
${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }}-${{ steps.vars.outputs.image_anchor }}
${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }}