Skip to content

Instantly share code, notes, and snippets.

@cbowns
Created August 16, 2017 00:45
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 cbowns/8b55ebcfa5f669216ed486050e70ce1e to your computer and use it in GitHub Desktop.
Save cbowns/8b55ebcfa5f669216ed486050e70ce1e to your computer and use it in GitHub Desktop.
Rename your iOS archives to include the app's version and build number
# Pardon the craziness:
# Given a directory of `*.xcarchive`s:
# enter your app's name for "<App name>", if you have a folder of
# heterogenous archives to process:
for dir (*); do
name=`defaults read "\`pwd\`"/$dir/Info.plist Name`
if [ "$name" = "<App name>" ];
then
echo "$dir:"
name=`defaults read "\`pwd\`"/$dir/Info.plist Name`
version=`defaults read "\`pwd\`"/$dir/Info.plist ApplicationProperties | grep -i CFBundleShortVersionString | sed 's/;//g' | sed 's/.* =//g' | sed 's/"//g' | awk '{$1=$1};1'`
build=`defaults read "\`pwd\`"/$dir/Info.plist ApplicationProperties | grep -i CFBundleVersion | sed 's/;//g' | sed 's/.* =//g' | sed 's/"//g' | awk '{$1=$1};1'`
echo "moving to $name - $version - build $build - $dir"
mv $dir "$name - $version - build $build - $dir"
echo
else
echo 0
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment