Skip to content

Instantly share code, notes, and snippets.

@GMatrixGames
Last active January 13, 2023 03:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GMatrixGames/546fd19da2108ace36271666b7a8ff5f to your computer and use it in GitHub Desktop.
Save GMatrixGames/546fd19da2108ace36271666b7a8ff5f to your computer and use it in GitHub Desktop.
Updates the Unreal Engine Build.version json file using Git instead of Perforce for versioning.
#!/bin/sh
branch=$(git rev-parse --abbrev-ref HEAD)
revcount=$(git rev-list --count $branch)
modifiedrev=$(($revcount + 1))
basename=$(basename -s .git `git config --get remote.origin.url`)
branch=("++$basename+$branch")
contents="$(jq --arg branch "$branch" --arg modifiedrev "$modifiedrev" '. + {BranchName:$branch, Changelist:$modifiedrev|tonumber}' Engine/Build/Build.version)" && \
echo -E "${contents}" > Engine/Build/Build.version
git add Engine/Build/Build.version
echo "Updated Build.version to be inline with Git"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment