build(deps): bump docker/build-push-action from 5.4.0 to 6.1.0 (#186) #44
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 Publish | |
on: | |
push: | |
branches: | |
- master | |
- test/* | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
paths-ignore: | |
- "*.md" | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
variant: | |
- java21 | |
- java17 | |
- java11 | |
- java8 | |
include: | |
- variant: java17 | |
baseImage: eclipse-temurin:17-focal | |
platforms: linux/amd64,linux/arm/v7,linux/arm64 | |
tagPrefix: java17- | |
- variant: java21 | |
baseImage: eclipse-temurin:21-jre | |
platforms: linux/amd64,linux/arm64 | |
tagPrefix: java21- | |
- variant: java8 | |
baseImage: adoptopenjdk:8-jre-hotspot-focal | |
platforms: linux/amd64,linux/arm/v7,linux/arm64 | |
tagPrefix: java8- | |
- variant: java11 | |
baseImage: adoptopenjdk:11-jre-hotspot-focal | |
platforms: linux/amd64,linux/arm/v7,linux/arm64 | |
tagPrefix: java11- | |
env: | |
DOCKER_HUB_ORG: itzg | |
MAIN_VARIANT: java21 | |
steps: | |
- uses: actions/checkout@v4.1.7 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5.5.1 | |
with: | |
images: | | |
${{ env.DOCKER_HUB_ORG }}/bungeecord | |
${{ env.DOCKER_HUB_ORG }}/mc-proxy | |
ghcr.io/${{ github.repository_owner }}/mc-proxy | |
tags: | | |
# For the "main" variant, it gets the tag as-is, without suffix | |
type=ref,event=tag,enable=${{ matrix.variant == env.MAIN_VARIANT }} | |
# and each variant (including main one) gets the tag with the variant suffix, such as 2023.1.1-java17 | |
type=ref,event=tag,suffix=-${{ matrix.variant }} | |
# latest repo tag gets a moving 'stable' image tag applied to the main variant | |
type=raw,value=stable,enable=${{ github.ref_type == 'tag' && matrix.variant == env.MAIN_VARIANT }} | |
# apply the variant as a moving tag for most recent commit per variant | |
type=raw,value=${{ matrix.variant }},enable=${{ github.ref_name == github.event.repository.default_branch }} | |
# for building test/* branch images | |
type=ref,event=branch,suffix=-${{ matrix.variant }},enable=${{ github.ref_name != github.event.repository.default_branch }} | |
# legacy tag format of {variant}-{version} | |
type=ref,event=tag,prefix=${{ matrix.tagPrefix }} | |
# NOTE this identifies which variant will be published as "latest", which isn't | |
# necessarily the newest version of Java | |
flavor: | | |
latest=${{ matrix.variant == env.MAIN_VARIANT && github.ref_name == github.event.repository.default_branch }} | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3.3.0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3.0.0 | |
- name: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3.2.0 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Login to GHCR | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3.2.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v6.1.0 | |
with: | |
platforms: ${{ matrix.platforms }} | |
# ensure latest base image is used | |
pull: true | |
push: true | |
build-args: | | |
BASE_IMAGE=${{ matrix.baseImage }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha,scope=${{ matrix.variant }} | |
cache-to: type=gha,mode=max,scope=${{ matrix.variant }} |