Skip to content

Instantly share code, notes, and snippets.

@rob-murray
Last active June 4, 2019 05:07
Show Gist options
  • Save rob-murray/7941761 to your computer and use it in GitHub Desktop.
Save rob-murray/7941761 to your computer and use it in GitHub Desktop.
Script to upload .ipa file to Testflight
#!/bin/bash
#
# Simple script to upload .ipa to testflight
# Usage: upload_testflight.sh /path/to/file.ipa /path/to/app.dSYM {build version}
#
# src: https://gist.github.com/rob-murray/7941761
#
if [ $# -lt 3 ]
then
echo "Usage: $1 path_to_ipa $2 path_to_dsym $3 build"
exit
fi
IPA_FILE="$1"
DSYM_FILE="$2"
BUILD_VER="$3"
if ! [ -f "$IPA_FILE" ]
then
echo "File not found: $IPA_FILE"
exit
fi
if [ -z "$BUILD_VER" ]
then
BUILD_VER="undefined"
fi
if ! [ -f "$DSYM_FILE" ]
then
echo "dSYM file not found: $DSYM_FILE"
fi
# Config items
# @see https://www.testflightapp.com/api/doc/
API_ENDPOINT="http://testflightapp.com/api/builds.json"
API_TOKEN="<API_TOKEN>"
TEAM_TOKEN="<TEAM_TOKEN>"
DIST_LIST="Just Devs" #not used yet
echo "Zipping up dSYM"
ZIP=".zip"
ZIPPED_DSYM=$DSYM_FILE$ZIP
/usr/bin/zip -r $ZIPPED_DSYM $DSYM_FILE
echo "Deploying IPA: ${IPA_FILE} with dSYM: ${ZIPPED_DSYM} with BUILD_VER ${BUILD_VER}"
# add -i for info
/usr/bin/curl -i --progress-bar "${API_ENDPOINT}" \
-F file=@"${IPA_FILE}" \
-F api_token="${API_TOKEN}" \
-F team_token="${TEAM_TOKEN}" \
-F notes="Build uploaded automatically from Xcode. Build: ${BUILD_VER}" \
-F dsym=@"${ZIPPED_DSYM}" \
#-F notify=True \
#-F distribution_lists="${DIST_LIST}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment