Enforce build numbers of official builds in build.sh

Also fix the current build numbers.
This commit is contained in:
Tamás Bálint Misius 2023-10-26 20:00:40 +02:00
parent eb29915243
commit 1c1e3aaf5a
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
2 changed files with 37 additions and 6 deletions

39
.github/build.sh vendored
View File

@ -246,13 +246,21 @@ if [[ $RELEASE_TYPE == stable ]]; then
fi
if [[ $stable_or_beta == yes ]]; then
xyz=$(echo $RELEASE_NAME | cut -d 'v' -f 2 | cut -d 'b' -f 1) # $RELEASE_NAME is vX.Y.Z or vX.Y.Zb
meson_configure+=$'\t'-Ddisplay_version_major=$(echo $xyz | cut -d '.' -f 1)
meson_configure+=$'\t'-Ddisplay_version_minor=$(echo $xyz | cut -d '.' -f 2)
meson_configure+=$'\t'-Dbuild_num=$(echo $xyz | cut -d '.' -f 3)
display_version_major=$(echo $xyz | cut -d '.' -f 1)
display_version_minor=$(echo $xyz | cut -d '.' -f 2)
build_num=$(echo $xyz | cut -d '.' -f 3)
if [[ $MOD_ID != 0 ]]; then
meson_configure+=$'\t'-Ddisplay_version_major=$display_version_major
meson_configure+=$'\t'-Ddisplay_version_minor=$display_version_minor
meson_configure+=$'\t'-Dbuild_num=$build_num
fi
fi
if [[ $RELEASE_TYPE == snapshot ]]; then
build_num=$(echo $RELEASE_NAME | cut -d '-' -f 2) # $RELEASE_NAME is snapshot-X
meson_configure+=$'\t'-Dsnapshot=true
meson_configure+=$'\t'-Dbuild_num=$(echo $RELEASE_NAME | cut -d '-' -f 2) # $RELEASE_NAME is snapshot-X
if [[ $MOD_ID != 0 ]]; then
meson_configure+=$'\t'-Dbuild_num=$build_num
fi
fi
if [[ $RELEASE_TYPE == snapshot ]] && [[ $MOD_ID != 0 ]]; then
>&2 echo "mods and snapshots do not mix"
@ -357,6 +365,29 @@ meson_configure+=$'\t'-Dc_link_args=[$c_link_args]
meson_configure+=$'\t'-Dcpp_link_args=[$c_link_args]
$meson_configure build
cd build
function verify_version_component() {
local key=$1
local expected=$2
local actual=$(jq -r '.[] | select(.name == "'$key'") | .value' < meson-info/intro-buildoptions.json)
if [[ $actual != $expected ]]; then
>&2 echo "meson option $key expected to be $expected, is instead $actual"
exit 1
fi
}
if [[ $stable_or_beta == yes ]] && [[ $MOD_ID == 0 ]]; then
verify_version_component display_version_major $display_version_major
verify_version_component display_version_minor $display_version_minor
verify_version_component build_num $build_num
verify_version_component upstream_version_major $display_version_major
verify_version_component upstream_version_minor $display_version_minor
verify_version_component upstream_build_num $build_num
fi
if [[ $RELEASE_TYPE == snapshot ]] && [[ $MOD_ID == 0 ]]; then
verify_version_component build_num $build_num
verify_version_component upstream_build_num $build_num
fi
strip=strip
objcopy=objcopy
strip_target=$ASSET_PATH

View File

@ -54,7 +54,7 @@ option(
'build_num',
type: 'integer',
min: 0,
value: 352,
value: 353,
description: 'Build number, should be strictly monotonously increasing across public releases'
)
option(
@ -75,7 +75,7 @@ option(
'upstream_build_num',
type: 'integer',
min: 0,
value: 352,
value: 353,
description: 'Upstream build number, mod owners should not change this but merge upstream changes to it'
)
option(