Skip to content

Instantly share code, notes, and snippets.

@charlesbedrosian
Last active August 29, 2015 14:11
Show Gist options
  • Save charlesbedrosian/e56654b345d0980e8b1c to your computer and use it in GitHub Desktop.
Save charlesbedrosian/e56654b345d0980e8b1c to your computer and use it in GitHub Desktop.
push build to testflight. This is based on the codebase at https://gist.github.com/c0diq/2213571 but greatly reduced and refocused for automated use.
#!/bin/bash
if [[ "$WORKSPACE" == "" ]]; then
WORKSPACE=$(pwd)
fi
#specify these configuration values
TESTFLIGHT_API_TOKEN=""
TESTFLIGHT_TEAM_TOKEN=""
DISTRIBUTION_LISTS_DEFAULT_SELECTION="CI"
DEFAULT_NOTIFY_VALUE="True"
DEFAULT_RELEASE_NOTES="Just another test version."
SKIP_DISTRIBUTION_LISTS="YES"
SKIP_NOTIFY="YES"
echo "Starting Upload Process"
IPA_FILE_PATH=`find ${WORKSPACE}/build -type f -name \*.ipa | head -1`
echo "Found $IPA_FILE_PATH"
# Build paths from build settings environment vars:
DSYM_PATH="$ARCHIVE_DSYMS_PATH"
APP="$ARCHIVE_PRODUCTS_PATH/$INSTALL_PATH/$WRAPPER_NAME"
NOTES="$DEFAULT_RELEASE_NOTES"
echo "Added release notes:"
echo "$NOTES"
SELECTED_DISTRIBUTION_LISTS="$DISTRIBUTION_LISTS_DEFAULT_SELECTION"
echo
echo "Selected Distribution Lists: '$SELECTED_DISTRIBUTION_LISTS'"
SHOULD_NOTIFY="$DEFAULT_NOTIFY_VALUE"
echo
echo "Notify: $SHOULD_NOTIFY"
# Now onto the upload itself
echo
echo "Uploading ... "
pushd "/tmp"
/usr/bin/curl "https://testflightapp.com/api/builds.json" \
-F file=@"$IPA_FILE_PATH" \
-F api_token="$TESTFLIGHT_API_TOKEN" \
-F team_token="$TESTFLIGHT_TEAM_TOKEN" \
-F replace=True \
-F notify="$SHOULD_NOTIFY" \
-F distribution_lists="$SELECTED_DISTRIBUTION_LISTS" \
-F notes="$NOTES" 2>&1
# -F dsym=@"$DWARF_DSYM_FILE_NAME.zip" \
popd
echo
echo "Uploaded to TestFlight!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment