ci: build: generate release version files for tags

Release binaries must be reproducible from the sources shipped with them.
Generate version and version.date from git when CI_COMMIT_TAG is set,
before the build reads either value.

Compute both values before writing either file, then print them for
traceability. The tag condition is the exact complement of the development
guard, so generation cannot run on development builds.

Assisted-by: codex:gpt-5.6-sol:medium-fast
Assisted-by: claude:opus-5:orchestrator
Signed-off-by: Petr Štetiar <petr.stetiar@prplfoundation.org>
References: PCF-2730
This commit is contained in:
Petr Štetiar 2026-08-05 15:42:44 +02:00 committed by Hela Saadani
parent ff467a1172
commit 742dd9cd65

View File

@ -52,6 +52,15 @@
exit 1
fi
- |
if [ -n "$CI_COMMIT_TAG" ]; then
release_version="$(scripts/getver.sh)"
release_version_date="$(scripts/get_source_date_epoch.sh)"
printf '%s\n' "$release_version" > version
printf '%s\n' "$release_version_date" > version.date
printf 'Generated release version data: version=%s version.date=%s\n' "$release_version" "$release_version_date"
fi
- |
if [ -z "$CI_COMMIT_TAG" ] && [ "$CI_DESIGNATED_BRANCH" != "$CI_COMMIT_BRANCH" ]; then
echo "Enabling coredumps and exception tracing in the build."