From bd6410200148156d402810f9e2b1ae042c165423 Mon Sep 17 00:00:00 2001 From: Ihor Dutchak Date: Sun, 14 Jun 2026 14:06:07 +0300 Subject: [PATCH] appveyor: derive the build version from the repo The "Build version format" was hard-coded in the AppVeyor project settings. Move it into the repo: set a placeholder version in .appveyor.yml (which overrides the UI setting) and, in before_build, replace it with the version from the VERSION file, the short commit hash and the build number, e.g. 0.16.0-1a2b3c4.42. The build number keeps each build's version unique even if the same commit is built more than once. Assisted-by: claude-code:claude-opus-4-8 --- .appveyor.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.appveyor.yml b/.appveyor.yml index 210b3fa46..fa2d0c281 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,3 +1,9 @@ +# The build version is derived from the repo here, which overrides the +# hard-coded "Build version format" in the AppVeyor project settings. The +# {build} placeholder is replaced in before_build with the version read from +# the VERSION file plus the short commit hash (see below). +version: '{build}' + environment: matrix: - BUILD_ENV: msbuild @@ -6,6 +12,15 @@ environment: arch: Win32 - BUILD_ENV: cygwin +# Derive the build version from the repo: -., +# e.g. 0.16.0-1a2b3c4.42. The build number keeps it unique even if the same +# commit is built more than once. +before_build: + - ps: | + $base = (Get-Content -Raw "$env:APPVEYOR_BUILD_FOLDER/VERSION").Trim() + $short = git rev-parse --short HEAD + Update-AppveyorBuild -Version "$base-$short.$env:APPVEYOR_BUILD_NUMBER" + for: - matrix: