From 34b9f369890be7971a8622d63797148fc6f50f94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Sun, 17 Nov 2024 22:37:48 +0100 Subject: [PATCH] Fix setting of env variables --- .github/workflows/ci.yml | 1 + scripts/build | 20 +++++++++----------- scripts/setenv | 4 +--- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f0e8df563..73221b677b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -180,6 +180,7 @@ jobs: platform: [win32, x64, arm64] env: PLATFORM: ${{ matrix.platform }} + DISTANCE_FROM_TAG: ${{ needs.build_variables.outputs.distance }} steps: - name: Setup environment run: | diff --git a/scripts/build b/scripts/build index c1dbe3a00a..5e6164d204 100755 --- a/scripts/build +++ b/scripts/build @@ -12,17 +12,15 @@ cd $basedir if [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]]; then # Patch version.h - if [[ -n "$OPENRCT2_BUILD" ]]; then - echo -e "\033[0;36mPatching version.h...\033[0m" - fileversion=$OPENRCT2_VERSION.$OPENRCT2_BUILD - productversion="$fileversion-${OPENRCT2_SHA1_SHORT}" - fileversion=${fileversion//./,} - # FILEVERSION in the resource file can only take up to 4 digits in the version string, so we remove the surplus of version numbers - fileversion=$(echo $fileversion | cut -f1-4 -d",") - echo "#define OPENRCT2_FILE_VERSION $fileversion" > "resources/version.h" - echo "#define OPENRCT2_PRODUCT_VERSION \"$productversion\"" >> "resources/version.h" - cat "resources/version.h" - fi + echo -e "\033[0;36mPatching version.h...\033[0m" + fileversion=$OPENRCT2_VERSION.$OPENRCT2_BUILD + productversion="$fileversion-${OPENRCT2_SHA1_SHORT}" + fileversion=${fileversion//./,} + # FILEVERSION in the resource file can only take up to 4 digits in the version string, so we remove the surplus of version numbers + fileversion=$(echo $fileversion | cut -f1-4 -d",") + echo "#define OPENRCT2_FILE_VERSION $fileversion" > "resources/version.h" + echo "#define OPENRCT2_PRODUCT_VERSION \"$productversion\"" >> "resources/version.h" + cat "resources/version.h" # Build everything echo -e "\033[0;36mBuilding OpenRCT2 for Windows $CONFIGURATION|$PLATFORM...\033[0m" diff --git a/scripts/setenv b/scripts/setenv index 9ad51e1643..ef2593f60e 100755 --- a/scripts/setenv +++ b/scripts/setenv @@ -16,9 +16,7 @@ echo -e "\033[0;36mSetting up environment for OpenRCT2...\033[0m" # Get the build number (number of commits since last tag) get_build_number() { - local pattern='.+-([0-9]+)-.+' - [[ $OPENRCT2_DESCRIBE =~ $pattern ]] - echo "${BASH_REMATCH[1]}" + echo "${DISTANCE_FROM_TAG}" } export OPENRCT2_BUILD=$(get_build_number)