Last active
July 4, 2016 14:26
-
-
Save apacha/ae6cfe11b8ac35d3389085b7e44a3c82 to your computer and use it in GitHub Desktop.
Replace version-number in Visual Studio Team Service Build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Sample call: ./ApplyVersionToAssemblies.sh ../Source/ AssemblyInfo.cs XamarinAndroid_1.0.0.1 | |
echo "Script to automatically set the version-number in files (e.g. AssemblyInfo.cs)" | |
if [ $# -ne 3 ]; then | |
echo "Usage: $0 path_to_search filename build_number" | |
exit | |
fi | |
# Input is something like XamarinAndroid_1.2.3.4 and we want to extract only the 1.2.3.4 | |
# See http://stackoverflow.com/a/19482947/448357 for more infos | |
VERSION_NUMBER="${3#*_}" | |
for file in $(find $1 -name $2); do | |
echo "Replacing Version string in $file with ${VERSION_NUMBER}" | |
sed -i '' -e 's/"[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*"/"'${VERSION_NUMBER}'"/' "$file" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment