Skip to content

Instantly share code, notes, and snippets.

@domzilla
Created October 15, 2015 08:31
Show Gist options
  • Save domzilla/931e7b5b1080e5113c2a to your computer and use it in GitHub Desktop.
Save domzilla/931e7b5b1080e5113c2a to your computer and use it in GitHub Desktop.
#! /bin/sh
#HOWTO: Put this script in your "deliver" directory and
# edit the "languages" array below, so that it
# holds the contents of your srceenshots directory.
# Now execute the script and grab a hot beverage :)
# All languages in your screenshots directory
languages=( de-DE en-US es-ES es-MX fr-CA fr-FR it ja ko nl-NL pt-BR pt-PT ru sv zh-Hans )
# Path to your screenshots directory
screenshots="./screenshots"
queue="queue"
uploaded="uploaded"
queuepath="${screenshots}/${queue}"
uploadedpath="${screenshots}/${uploaded}"
do_deliver () {
language=$1
echo "Delivering ${language}"
output="$(deliver --skip_metadata --force)"
if [[ $output == *"Finished the upload to iTunes Connect"* ]]; then
echo "${language}: successfully uploaded"
mv "${screenshots}/${language}" "${uploadedpath}/${language}"
else
echo "${language}: upload failed. Retrying..."
do_deliver "${language}"
fi
}
if [ ! -d "${queuepath}" ]; then
mkdir "${queuepath}"
for i in "${languages[@]}"
do
mv "${screenshots}/${i}" "${queuepath}/${i}"
done
fi
if [ ! -d "${uploadedpath}" ]; then
mkdir "${uploadedpath}"
fi
for i in "${languages[@]}"
do
if [ -d "${screenshots}/${i}" ]; then
do_deliver "${i}"
fi
done
find "${queuepath}" -maxdepth 1 -mindepth 1 | while read -r dir
do
language="${dir##*/}"
mv "${dir}" "${screenshots}/${language}"
do_deliver "${language}"
done
rm -r "${queuepath}"
find "${uploadedpath}" -maxdepth 1 -mindepth 1 | while read -r dir
do
language="${dir##*/}"
mv "${dir}" "${screenshots}/${language}"
done
rm -r "${uploadedpath}"
echo "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment