Skip to main content

Archive and distribute

sweetpad archive produces a distributable build: it runs xcodebuild archive to make an .xcarchive, then exports it into an .ipa (or a signed .app, for macOS).

sweetpad archive

Both artifacts land in ./build unless you say otherwise:

sweetpad archive --output-file ./dist

Choosing how it's exported

The export method decides which provisioning profile and entitlements the export uses, and therefore where the result can be installed:

--export-methodFor
debuggingDevelopment builds, installable on registered devices. Default.
app-store-connectUploading to App Store Connect.
release-testingTestFlight-external and ad-hoc style release testing.
enterpriseIn-house enterprise distribution.
developer-idmacOS Developer ID: notarizable, distributed outside the App Store.
mac-applicationmacOS: a signed .app, with no installer around it.
sweetpad archive --export-method app-store-connect

A release archive is normally a Release build, and SweetPad uses whatever configuration your context resolves to, so say so explicitly rather than assuming:

sweetpad archive --configuration Release --export-method app-store-connect

sweetpad status tells you which configuration is in effect and why.

Bringing your own export options

SweetPad generates an ExportOptions.plist from --export-method. When your distribution needs options that flag can't express (a specific provisioning profile mapping, symbol stripping choices, a manageAppVersionAndBuildNumber setting) supply the plist yourself:

sweetpad archive --export-options ./ExportOptions.plist

To stop before the export entirely, and hand the .xcarchive to something else:

sweetpad archive --no-export

Signing

Archiving is where signing stops being optional, and it's the one part xcodebuild usually wants more from you than SweetPad asks for. Pass what it needs through the -- tail:

sweetpad archive -- -allowProvisioningUpdates
sweetpad archive -- -allowProvisioningUpdates DEVELOPMENT_TEAM=ABCDE12345

If every archive in the project needs the same thing, write it down once in sweetpad.toml instead of typing it each release:

# sweetpad.toml
[xcodebuild]
args = ["-allowProvisioningUpdates"]

See Configuration for what belongs there and what doesn't.

Checking before you commit to a run

An archive is slow, and a signing mistake usually surfaces at the end of it. --show-command prints the exact invocations without running them:

sweetpad archive --show-command

In CI

The pieces from Scripts and CI apply here unchanged: pin the context, keep the output machine-readable, and upload what you built:

- name: Archive
run: |
sweetpad archive \
--configuration Release \
--export-method app-store-connect \
--output-file ./dist \
-- -allowProvisioningUpdates
env:
SWEETPAD_SCHEME: MyApp

- name: Upload IPA
uses: actions/upload-artifact@v4
with:
name: ipa
path: ./dist/*.ipa

A failed archive exits non-zero, so the job stops on its own without an explicit check. See exit codes for telling a broken build apart from a misconfigured one.