When I archive from the command line using xcodebuild archive
, how can I get the path to the newly created archive? I'd like to follow on with an -exportArchive
command to create an adhoc distribution.
I know that I can define an -archivePath
, however if I do that then Organizer doesnt know where about this archive, so that's no good.
Thoughts?
Xcode created your archive. The actual . xcarchive folder resides on your Mac in ~/Library/Developer/Xcode/Archives.
The . xcarchive will be placed in the $HOME/Library/Developer/Xcode/Archives directory on the Mac build host that both Xcode and Xamarin Studio search to display previously built archives. See the documentation about Xamarin.
The Archives organizer is a pane in the Organizer window that you use to upload your app to App Store Connect. To open the Archives organizer, choose Window > Organizer and click Archives. To complete the upload of your app to App Store Connect, click the blue Upload to App Store button.
Make sure your build is successfulBefore beginning to archive your build, you need to make sure that the build is successful not only for Debug, for also for Release. Remember to test thoroughly with different types of scenarios to make sure there's no crash or bug.
you can simply create a variable holding the path of the archive you want to generate. Then use the same path when you want to export
$ARCHIVE_PATH="<path_of_your_archive>" # can be something like "build/app_name.xcarchive"
# ARCHIVING
xcodebuild archive \
-workspace "${APP_NAME}.xcworkspace" \
-configuration $CONFIGUATION \
-scheme $SCHEME \
-archivePath $ARCHIVE_PATH
# EXPORTING
xcodebuild -exportArchive \
-archivePath $ARCHIVE_PATH \
-exportPath $OUTPUT_DIRECTORY \
-exportOptionsPlist exportPlist.plist
Hope this helps you in any way!
There's $ARCHIVE_PATH
variable that's only available in archive post-actions scripts
Edit:
$ARCHIVE_PATH
returns a kind of generic path that doesn't account for the date, time, or duplicate suffixes.
Use $ARCHIVE_PRODUCTS_PATH
instead. Or actually REAL_ARCHIVE_PATH=$(dirname ${ARCHIVE_PRODUCTS_PATH})
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With