Skip to content

Instantly share code, notes, and snippets.

@bizz84
Created November 26, 2024 11:35
Show Gist options
  • Save bizz84/0a00a48dce7982cf3b3cc59c940ee344 to your computer and use it in GitHub Desktop.
Save bizz84/0a00a48dce7982cf3b3cc59c940ee344 to your computer and use it in GitHub Desktop.
Simple script to build and upload the IPA file to App Store Connect
#!/bin/bash
# Script to build and upload the ipa file to App Store Connect
# Exit immediately if any command fails
set -e
# Validate that the API Key ID and Issuer ID are set
if [[ -z ${APP_STORE_CONNECT_KEY_ID} ]]; then
echo "Please set APP_STORE_CONNECT_KEY_ID as an environment variable."
exit 1
fi
if [[ -z ${APP_STORE_CONNECT_ISSUER_ID} ]]; then
echo "Please set APP_STORE_CONNECT_ISSUER_ID as an environment variable."
exit 1
fi
# Start from a clean slate
# This ensures that there's only one *.ipa inside build/ios/ipa when uploading with xcrun
flutter clean
flutter pub get
# Build the IPA file using Flutter
echo "Building the IPA..."
flutter build ipa # TODO: add your app-specific build arguments here
# Upload the IPA file to App Store Connect using xcrun
echo "Uploading the IPA to App Store Connect..."
xcrun altool --upload-app --type ios --file build/ios/ipa/*.ipa --apiKey ${APP_STORE_CONNECT_KEY_ID} --apiIssuer ${APP_STORE_CONNECT_ISSUER_ID}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment