Skip to content

build: move automated job later #2067

build: move automated job later

build: move automated job later #2067

Workflow file for this run

name: buildx
on:
schedule:
- cron: "37 06 * * *"
push:
branches:
- master
pull_request:
jobs:
buildx:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java-version: [8, 11, 17, 21]
java-type: [jdk, jre]
node-version: [18, 20, 22]
variant: [default, alpine]
include:
- variant: default
platforms: linux/amd64,linux/arm64,linux/ppc64le
- variant: alpine
platforms: linux/amd64
- java-version: 11
variant: default
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v7
steps:
- uses: actions/[email protected]
- name: Set Node.js codename
id: nodename
run: |
case "${{ matrix.node-version }}" in
"18") echo "codename=hydrogen" >> $GITHUB_OUTPUT ;;
"20") echo "codename=iron" >> $GITHUB_OUTPUT ;;
"22") echo "codename=jod" >> $GITHUB_OUTPUT ;;
"24") echo "codename=krypton" >> $GITHUB_OUTPUT ;;
"26") echo "codename=lithium" >> $GITHUB_OUTPUT ;;
"28") echo "codename=magnesium" >> $GITHUB_OUTPUT ;;
esac
- name: Prepare
id: prepare
run: |
DOCKER_IMAGE=timbru31/java-node
VERSION="${{ matrix.java-version }}"
NODE_CODENAME=${{ steps.nodename.outputs.codename }}
VARIANT="${{ matrix.variant == 'alpine' && '-alpine' || '' }}"
TYPE="${{ matrix.java-type }}"
# Generate tag combinations
if [ "$TYPE" = "jdk" ]; then
TAGS="${DOCKER_IMAGE}:${VERSION}${VARIANT}-jdk-${{ matrix.node-version }}"
TAGS="${TAGS},${DOCKER_IMAGE}:${VERSION}${VARIANT}-jdk-${NODE_CODENAME}"
else
TAGS="${DOCKER_IMAGE}:${VERSION}${VARIANT}-${{ matrix.node-version }}"
TAGS="${TAGS},${DOCKER_IMAGE}:${VERSION}${VARIANT}-${NODE_CODENAME}"
TAGS="${TAGS},${DOCKER_IMAGE}:${VERSION}${VARIANT}-jre-${{ matrix.node-version }}"
TAGS="${TAGS},${DOCKER_IMAGE}:${VERSION}${VARIANT}-jre-${NODE_CODENAME}"
fi
echo "docker_image=${DOCKER_IMAGE}" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
id: buildx
uses: docker/[email protected]
with:
install: true
- name: Docker Buildx (build)
uses: docker/[email protected]
if: success() && !contains(github.ref, 'master')
with:
push: false
context: ./${{ matrix.java-version }}/${{ matrix.java-type }}/${{ matrix.node-version }}${{ matrix.variant == 'alpine' && '/alpine' || '' }}
file: ./${{ matrix.java-version }}/${{ matrix.java-type }}/${{ matrix.node-version }}${{ matrix.variant == 'alpine' && '/alpine' || '' }}/Dockerfile
build-args: REFRESHED_AT=$(date +%Y-%m-%d)
platforms: ${{ matrix.platforms }}
tags: ${{ steps.prepare.outputs.tags }}
- name: Docker Login
if: success() && github.event_name != 'pull_request' && contains(github.ref, 'master')
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker Buildx (push)
uses: docker/[email protected]
if: success() && github.event_name != 'pull_request' && contains(github.ref, 'master')
with:
push: true
context: ./${{ matrix.java-version }}/${{ matrix.java-type }}/${{ matrix.node-version }}${{ matrix.variant == 'alpine' && '/alpine' || '' }}
file: ./${{ matrix.java-version }}/${{ matrix.java-type }}/${{ matrix.node-version }}${{ matrix.variant == 'alpine' && '/alpine' || '' }}/Dockerfile
build-args: REFRESHED_AT=$(date +%Y-%m-%d)
platforms: ${{ matrix.platforms }}
tags: ${{ steps.prepare.outputs.tags }}
- name: Inspect Image
if: always() && github.event_name != 'pull_request' && contains(github.ref, 'master')
run: |
docker buildx imagetools inspect $(echo "${{ steps.prepare.outputs.tags }}" | cut -d',' -f1)
- name: Clear
if: always() && github.event_name != 'pull_request'
run: |
rm -f ${HOME}/.docker/config.json