From 02e30b483a7d11d3f0945d0daec5e90f3390732b Mon Sep 17 00:00:00 2001 From: Matthias Linhuber Date: Tue, 25 Aug 2026 18:55:25 +0200 Subject: [PATCH] feat: optional APP_VERSION build arg stamped from the derived tag Images whose build embeds a version - the Java services stamp it into the jar manifest - need the version inside the image to match the tag on the outside. The caller cannot compute it: GitHub expressions have no substring, so stripping the leading v from a release tag is not expressible there, and the tag derivation already lives here. stamp-app-version: true appends APP_VERSION= to build-args, using the tag this workflow already derived and validated. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_019qeiQRFu8xAMRYWPdZewjG --- .github/workflows/build-and-push-docker-image.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push-docker-image.yml b/.github/workflows/build-and-push-docker-image.yml index b1c6137..c72c9b4 100644 --- a/.github/workflows/build-and-push-docker-image.yml +++ b/.github/workflows/build-and-push-docker-image.yml @@ -73,6 +73,14 @@ on: type: boolean default: false description: "Bypass the layer cache (nightly builds use this)" + stamp-app-version: + type: boolean + default: false + description: | + Append APP_VERSION= to build-args. Use for images whose + build embeds a version (the Java services stamp it into the jar), so + the version inside the image matches the tag on the outside. The tag + is the derived one, with any leading v already stripped. free-disk-space: type: boolean default: true @@ -287,7 +295,9 @@ jobs: context: ${{ inputs.docker-context }} file: ${{ inputs.docker-file }} platforms: ${{ matrix.platform }} - build-args: ${{ inputs.build-args }} + build-args: | + ${{ inputs.build-args }} + ${{ inputs.stamp-app-version && format('APP_VERSION={0}', needs.setup.outputs.base_tag) || '' }} labels: ${{ inputs.labels }} secrets: ${{ secrets.docker-secrets }} no-cache: ${{ inputs.no-cache }}