Skip to content

Instantly share code, notes, and snippets.

@rvi
Last active March 1, 2018 10:13
Show Gist options
  • Save rvi/7796647 to your computer and use it in GitHub Desktop.
Save rvi/7796647 to your computer and use it in GitHub Desktop.
Build, archive package iOS app and publish to testflight
pod install
xcodebuild -workspace MyProject.xcworkspace -scheme "MyScheme" -destination=build -configuration Release -sdk iphoneos7.0 ONLY_ACTIVE_ARCH=YES clean build archive
# Common path and partial filename
ARCHIVE_BASEPATH="${HOME}/Library/Developer/Xcode/Archives/$(date +%Y-%m-%d)/${XCODE_SCHEME}"
# Find the latest .xcarchive for the given scheme
NEW_ARCHIVE=$(ls -td "${ARCHIVE_BASEPATH}"* | head -n 1)
# Export
xcodebuild -exportArchive -exportFormat "IPA" -archivePath "$NEW_ARCHIVE" -exportPath ./MyAPP.ipa -exportProvisioningProfile "My Distribution provisionning profile"
# Upload to testflight
/usr/bin/curl "http://testflightapp.com/api/builds.json" \
-F file=@"MyAPP.ipa" \
-F api_token="YOUR_API_TOKEN" \
-F team_token="_YOUR_TEAM_TOKEN" \
-F notes="Build uploaded from Jenkins." \
-F notify="True" \
-F distribution_lists="Lima"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment