2021-02-06 20:52:20 +00:00
|
|
|
name: Build and publish multiarch
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-05-21 12:46:49 +00:00
|
|
|
- master
|
2022-01-17 02:49:15 +00:00
|
|
|
- test/**
|
2021-02-06 20:52:20 +00:00
|
|
|
tags:
|
2021-05-21 12:39:59 +00:00
|
|
|
- "[0-9]+.[0-9]+.[0-9]+"
|
2021-05-01 22:39:35 +00:00
|
|
|
paths-ignore:
|
|
|
|
- "*.md"
|
2021-05-02 23:31:08 +00:00
|
|
|
- "docs/**"
|
|
|
|
- "examples/**"
|
2021-02-06 20:52:20 +00:00
|
|
|
|
|
|
|
jobs:
|
2021-12-05 00:42:03 +00:00
|
|
|
build:
|
2022-01-29 20:53:34 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
variant:
|
|
|
|
- java17
|
|
|
|
- java17-openj9
|
2022-02-12 03:00:24 +00:00
|
|
|
- java17-alpine
|
|
|
|
- java8
|
2022-01-29 20:53:34 +00:00
|
|
|
- java8-multiarch
|
|
|
|
- java8-openj9
|
|
|
|
- java11
|
|
|
|
- java11-openj9
|
|
|
|
include:
|
|
|
|
- variant: java17
|
|
|
|
baseImage: eclipse-temurin:17
|
|
|
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
|
|
|
mcVersion: LATEST
|
|
|
|
- variant: java17-openj9
|
|
|
|
baseImage: ibm-semeru-runtimes:open-17-jdk
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
mcVersion: LATEST
|
2022-02-12 03:00:24 +00:00
|
|
|
- variant: java17-alpine
|
|
|
|
baseImage: eclipse-temurin:17-jdk-alpine
|
|
|
|
platforms: linux/amd64
|
|
|
|
mcVersion: LATEST
|
|
|
|
- variant: java8
|
|
|
|
baseImage: openjdk:8-jdk-alpine3.8
|
|
|
|
platforms: linux/amd64
|
|
|
|
mcVersion: 1.12.2
|
2022-01-29 20:53:34 +00:00
|
|
|
- variant: java8-multiarch
|
2022-02-24 13:08:06 +00:00
|
|
|
baseImage: eclipse-temurin:8u312-b07-jre
|
2022-02-03 04:27:38 +00:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2022-01-29 20:53:34 +00:00
|
|
|
mcVersion: 1.12.2
|
|
|
|
- variant: java8-openj9
|
|
|
|
baseImage: ibm-semeru-runtimes:open-8-jdk
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
mcVersion: 1.12.2
|
|
|
|
- variant: java11
|
|
|
|
baseImage: adoptopenjdk:11-jdk-hotspot
|
|
|
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
|
|
|
mcVersion: 1.16.5
|
|
|
|
- variant: java11-openj9
|
|
|
|
baseImage: ibm-semeru-runtimes:open-11-jdk
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
mcVersion: 1.16.5
|
|
|
|
env:
|
2022-02-12 03:00:24 +00:00
|
|
|
IMAGE_TO_TEST: ${{ github.repository_owner }}/minecraft-server:test-${{ matrix.variant }}-${{ github.run_id }}
|
2021-02-06 20:52:20 +00:00
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2021-11-08 13:00:59 +00:00
|
|
|
uses: actions/checkout@v2.4.0
|
2022-02-12 03:00:24 +00:00
|
|
|
with:
|
|
|
|
# for build-files step
|
|
|
|
fetch-depth: 0
|
2021-02-06 20:52:20 +00:00
|
|
|
|
2021-05-14 22:48:17 +00:00
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v3
|
|
|
|
with:
|
2022-02-12 03:00:24 +00:00
|
|
|
# NOTE for forks: if your Docker Hub organization doesn't match your Github repo's,
|
|
|
|
# then the use of ${{ github.repository_owner }} will need to be replaced.
|
2021-05-14 22:48:17 +00:00
|
|
|
images: |
|
2022-02-12 03:00:24 +00:00
|
|
|
${{ github.repository_owner }}/minecraft-server
|
2021-05-14 22:48:17 +00:00
|
|
|
tags: |
|
2022-01-29 20:53:34 +00:00
|
|
|
type=ref,event=tag,enable=${{ matrix.variant == 'java17' }}
|
2022-02-05 22:02:27 +00:00
|
|
|
type=ref,event=tag,suffix=-${{ matrix.variant }}
|
2022-01-29 20:53:34 +00:00
|
|
|
type=raw,value=${{ matrix.variant }}
|
2021-05-22 04:00:27 +00:00
|
|
|
flavor: |
|
2022-01-29 20:53:34 +00:00
|
|
|
latest=${{ matrix.variant == 'java17' }}
|
|
|
|
labels: |
|
|
|
|
org.opencontainers.image.authors=Geoff Bourne <itzgeoff@gmail.com>
|
2021-02-06 20:52:20 +00:00
|
|
|
|
|
|
|
- name: Setup Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
2021-05-31 13:02:39 +00:00
|
|
|
uses: docker/setup-qemu-action@v1.2.0
|
2021-02-06 20:52:20 +00:00
|
|
|
|
|
|
|
- name: Login to DockerHub
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USER }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
|
2021-12-05 00:42:03 +00:00
|
|
|
- name: Build for test
|
2022-02-07 12:54:56 +00:00
|
|
|
uses: docker/build-push-action@v2.9.0
|
2021-12-05 00:42:03 +00:00
|
|
|
with:
|
|
|
|
platforms: linux/amd64
|
|
|
|
tags: ${{ env.IMAGE_TO_TEST }}
|
|
|
|
# ensure latest base image is used
|
|
|
|
pull: true
|
2022-01-29 20:53:34 +00:00
|
|
|
# load into daemon for test usage in next step
|
2021-12-05 00:42:03 +00:00
|
|
|
load: true
|
|
|
|
push: false
|
2022-01-29 20:53:34 +00:00
|
|
|
build-args: |
|
|
|
|
BASE_IMAGE=${{ matrix.baseImage }}
|
|
|
|
cache-from: type=gha,scope=${{ matrix.variant }}
|
2021-12-11 02:50:40 +00:00
|
|
|
# no cache-to to avoid cross-cache update from next build step
|
2021-12-05 00:42:03 +00:00
|
|
|
|
|
|
|
- name: Run tests
|
2022-01-29 20:53:34 +00:00
|
|
|
env:
|
|
|
|
MINECRAFT_VERSION: ${{ matrix.mcVersion }}
|
2021-12-05 00:42:03 +00:00
|
|
|
run: |
|
|
|
|
tests/test.sh
|
|
|
|
|
2021-02-06 20:52:20 +00:00
|
|
|
- name: Build and push
|
|
|
|
id: docker_build
|
2022-02-07 12:54:56 +00:00
|
|
|
uses: docker/build-push-action@v2.9.0
|
2021-02-06 20:52:20 +00:00
|
|
|
with:
|
2022-01-29 20:53:34 +00:00
|
|
|
platforms: ${{ matrix.platforms }}
|
2022-02-05 22:03:40 +00:00
|
|
|
push: ${{ github.ref_type == 'tag' || github.ref_name == 'master' }}
|
2021-05-14 22:48:17 +00:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
2021-02-09 03:27:25 +00:00
|
|
|
# ensure latest base image is used
|
|
|
|
pull: true
|
2021-05-14 22:48:17 +00:00
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2022-01-29 20:53:34 +00:00
|
|
|
build-args: |
|
|
|
|
BASE_IMAGE=${{ matrix.baseImage }}
|
2022-02-12 03:00:24 +00:00
|
|
|
BUILD_FILES_REV=${{ steps.build-files-rev.outputs.REV }}
|
2022-01-29 20:53:34 +00:00
|
|
|
cache-from: type=gha,scope=${{ matrix.variant }}
|
|
|
|
cache-to: type=gha,mode=max,scope=${{ matrix.variant }}
|