Skip to content

Instantly share code, notes, and snippets.

@koingdev
Last active October 15, 2024 09:22
Show Gist options
  • 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
@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

@Naveen9453
Copy link

@koingdev what command should i run to generate ipa file. and where i need to place this two file inside ios directory or inside root directory(in case of cross platform app)

@Naveen9453
Copy link

@byJeevan from where i can get YOUR_DISTRIBUTION_PROVISIONING_PROFILE_NAME

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