Fix setting of env variables

This commit is contained in:
Michał Janiszewski 2024-11-17 22:37:48 +01:00
parent 52f95f5d31
commit 34b9f36989
3 changed files with 11 additions and 14 deletions

View file

@ -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: |

View file

@ -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"

View file

@ -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)