Skip to content

Instantly share code, notes, and snippets.

@christianascone
Last active March 16, 2022 02:59
Show Gist options
  • Save christianascone/8374ae81e493a8efac41b75dd42167c0 to your computer and use it in GitHub Desktop.
Save christianascone/8374ae81e493a8efac41b75dd42167c0 to your computer and use it in GitHub Desktop.
Archive a project with Cocoapods dependencies
#!/bin/bash
PROJECT_NAME="$(ls -d *.xcworkspace* | cut -d'.' -f1)"
# REF: https://bitbar.com/tipstricks-how-to-archive-and-export-ipa-from-script/
# Clean project
echo "#### CLEAN ####"
xcodebuild clean -workspace "${PROJECT_NAME}".xcworkspace -configuration Release -scheme "${PROJECT_NAME}"
# Archive
echo "#### ARCHIVE ####"
xcodebuild archive -workspace "${PROJECT_NAME}".xcworkspace -configuration Release -scheme "${PROJECT_NAME}" -archivePath "${PROJECT_NAME}".xcarchive
# Export ipa
echo "#### EXPORT IPA ####"
xcodebuild -exportArchive -archivePath "${PROJECT_NAME}".xcarchive -exportPath "${PROJECT_NAME}" -exportOptionsPlist exportOptions.plist
# Clear
echo "#### CLEAR ARCHIVE ####"
rm -rf "${PROJECT_NAME}".xcarchive
#!/bin/bash
# PRETTY VERSION
PROJECT_NAME="$(ls -d *.xcworkspace* | cut -d'.' -f1)"
# REF: https://bitbar.com/tipstricks-how-to-archive-and-export-ipa-from-script/
# Clean project
echo "#### CLEAN ####"
xcodebuild clean -workspace "${PROJECT_NAME}".xcworkspace -configuration Release -scheme "${PROJECT_NAME}" | xcpretty
# Archive
echo "#### ARCHIVE ####"
xcodebuild archive -workspace "${PROJECT_NAME}".xcworkspace -configuration Release -scheme "${PROJECT_NAME}" -archivePath "${PROJECT_NAME}".xcarchive | xcpretty
# Export ipa
echo "#### EXPORT IPA ####"
xcodebuild -exportArchive -archivePath "${PROJECT_NAME}".xcarchive -exportPath "${PROJECT_NAME}" -exportOptionsPlist exportOptions.plist
# Clear
echo "#### CLEAR ARCHIVE ####"
rm -rf "${PROJECT_NAME}".xcarchive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment