From 2885728b8b2e64044ab5a9b7ca17ecdb03eca94f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20K=C3=A4stner?= Date: Fri, 25 Jul 2025 13:26:38 +0200 Subject: [PATCH] Provide `BININFO_*` docker build arguments to ghcr container workflow --- internal/ghworkflow/workflow_ghcr.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/internal/ghworkflow/workflow_ghcr.go b/internal/ghworkflow/workflow_ghcr.go index 1f5ac00a..8fe36a09 100644 --- a/internal/ghworkflow/workflow_ghcr.go +++ b/internal/ghworkflow/workflow_ghcr.go @@ -96,6 +96,15 @@ type=sha,format=long "tags": tags, }, }) + j.addStep(jobStep{ + Name: "Extract build-args for Docker", + ID: "build_args", + Run: makeMultilineYAMLString([]string{ + `echo "version=$(git describe --tags --always --abbrev=7)" >> $GITHUB_OUTPUT`, + `echo "commit=$(git rev-parse --verify HEAD)" >> $GITHUB_OUTPUT`, + `echo "date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT`, + }), + }) j.addStep(jobStep{ Name: "Set up QEMU", Uses: core.DockerQemuAction, @@ -118,6 +127,11 @@ type=sha,format=long "tags": "${{ steps.meta.outputs.tags }}", "labels": "${{ steps.meta.outputs.labels }}", "platforms": platforms, + "build-args": makeMultilineYAMLString([]string{ + "BININFO_VERSION=${{ steps.build_args.outputs.version }}", + "BININFO_COMMIT_HASH=${{ steps.build_args.outputs.commit }}", + "BININFO_BUILD_DATE=${{ steps.build_args.outputs.date }}", + }), }, }) w.Jobs = map[string]job{"build-and-push-image": j}