Skip to content

Release standalone image #1

Release standalone image

Release standalone image #1

name: Release standalone image
on:
workflow_dispatch:
inputs:
version:
description: Docker image version without the v prefix
required: true
type: string
publish_latest:
description: Also update the latest tag
required: true
default: false
type: boolean
push:
tags:
- 'v*'
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
BASE_VERSION: '45'
concurrency:
group: standalone-release-${{ github.ref }}
cancel-in-progress: false
jobs:
test:
name: Test
runs-on: ubuntu-24.04
steps:
- name: Check out the tagged source
uses: actions/checkout@v6
- name: Set up Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '11'
cache: maven
- name: Run unit tests
run: mvn --batch-mode clean install
publish:
name: Publish linux/amd64 image
needs: test
runs-on: ubuntu-24.04
steps:
- name: Check out the tagged source
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract image metadata
id: metadata
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}},enable=${{ github.event_name == 'push' }}
type=raw,value=${{ inputs.version }},enable=${{ github.event_name == 'workflow_dispatch' }}
type=raw,value=latest,enable=${{ github.event_name == 'push' || inputs.publish_latest }}
type=sha,prefix=sha-
- name: Build and publish standalone image
uses: docker/build-push-action@v7
with:
context: .
file: ./Resources/dockerStandalone/Dockerfile
build-args: BASEVERSION=${{ env.BASE_VERSION }}
platforms: linux/amd64
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
annotations: ${{ steps.metadata.outputs.annotations }}
cache-from: type=gha
cache-to: type=gha,mode=max