Skip to content

Instantly share code, notes, and snippets.

@ninjaprox
Created February 26, 2017 10:41
Show Gist options
  • Save ninjaprox/71628f262616e15cc1dcca235299e0eb to your computer and use it in GitHub Desktop.
Save ninjaprox/71628f262616e15cc1dcca235299e0eb to your computer and use it in GitHub Desktop.
Bump version in Info.plist
#!/bin/bash
component=$1
version=$(/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' Info.plist)
IFS="." read major minor patch <<< "$version"
echo "$version"
if [[ "$component" = 'major' ]]; then
major=$((major + 1))
minor=0
patch=0
elif [[ "$component" = 'minor' ]]; then
minor=$((minor + 1))
patch=0
elif [[ "$component" = 'patch' ]]; then
patch=$((patch + 1))
fi
version="${major}.${minor}.${patch}"
echo "$version"
/usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString ${version}" Info.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment