Skip to content

Instantly share code, notes, and snippets.

@koingdev
Last active November 8, 2023 08:23
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koingdev/9ef27832d6f88c4e20e2c0f0997a538a to your computer and use it in GitHub Desktop.
Save koingdev/9ef27832d6f88c4e20e2c0f0997a538a to your computer and use it in GitHub Desktop.
Script to automatically upload iOS App to AppStore and TestFlight (including versioning)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>destination</key>
<string>upload</string>
<key>method</key>
<string>app-store</string>
<key>provisioningProfiles</key>
<dict>
<key>YOUR_BUNDLE_ID</key> <!-- Please update this -->
<string>YOUR_DISTRIBUTION_PROVISIONING_PROFILE_NAME</string> <!-- Please update this -->
</dict>
<key>signingCertificate</key>
<string>iPhone Distribution</string>
<key>signingStyle</key>
<string>manual</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>YOUR_APPSTORE_TEAM_ID</string> <!-- Please update this -->
<key>uploadBitcode</key>
<true/>
<key>uploadSymbols</key>
<true/>
</dict>
</plist>
#!/bin/bash
# VARIABLES
APP_NAME="YOUR_APP_NAME" #Please update this
SCHEME="YOUR_SCHEME_NAME" #Please update this
ARCHIVE_PATH="~/Desktop/${APP_NAME}.xcarchive"
IPA_OUTPUT_PATH="~/Desktop/"
INFO_PLIST="Info.plist" #Path to Info.plist file
EXPORT_OPTION_PLIST="ExportOptions.plist" #Path to ExportOptions.plist file
# USER INPUT
echo "\n####### 😎 Welcome to ©KoingDev iOS Automated Deploy System 😎 ##########\n"
echo "☞ Enter version number:"
read VERSION
echo "\n☞ Enter build number:"
read BUILD_NUMBER
echo "\n##########################################################\n"
function upload() {
# VERSIONING
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${VERSION}" $INFO_PLIST
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${BUILD_NUMBER}" $INFO_PLIST
# ARCHIVING
echo "☞ Start archiving...\n"
xcodebuild archive \
-workspace "${APP_NAME}.xcworkspace" \
-scheme $SCHEME \
-archivePath $ARCHIVE_PATH \
-sdk iphoneos
# EXPORTING
echo "☞ Start exporting...\n"
xcodebuild -exportArchive \
-archivePath ${ARCHIVE_PATH} \
-exportPath ${IPA_OUTPUT_PATH} \
-exportOptionsPlist ${EXPORT_OPTION_PLIST}
}
# CONFIRMATION
read -p "Do you really want to upload with this version '${VERSION}' and build number '${BUILD_NUMBER}' (y/n)? " choice
case "$choice" in
y|Y ) upload ;;
n|N ) exit ;;
* ) exit ;;
esac
@koingdev
Copy link
Author

koingdev commented May 2, 2019

  • Download & copy the two files above to PROJECT DIRECTORY
  • Edit places where I comment Please update this
  • Run the script
  • Input the version and build number that you want to upload
  • Wait processing
  • Done
  • Check iTune Connect :D

@byJeevan
Copy link

byJeevan commented May 2, 2019

Really appreciated work..

@ajaydexati
Copy link

YOUR_BUNDLE_ID
YOUR_DISTRIBUTION_PROVISIONING_PROFILE_NAME

we should enter bundle id here or provision profile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment