Azure Pipelines Azure DevOps Server 2019 TFS 2018 TFS 2017
This guidance explains how to automatically build Xcode projects.
How to build a.dmg to distribute MacOS apps To release a MacOS app through the Mac App Store, there is an integrated wizard in Xcode. Distributing your MacOS app outside the Mac App Store is less documented. Open your project in Xcode. Do Product Archive. This brings up the project organizer with a list of archives. So far, this is the same.
Example
For a working example of how to build an app with Xcode, import (into Azure Repos or TFS) or fork (into GitHub) this repo:
The sample code includes an azure-pipelines.yml
file at the root of the repository. You can use this file to build the app.
Follow all the instructions in Create your first pipeline to create a build pipeline for the sample app.
Build environment
You can use Azure Pipelines to build your apps with Xcode without needing to set up any infrastructure of your own. Xcode is preinstalled on Microsoft-hosted macOS agents in Azure Pipelines. You can use the macOS agents to run your builds.
For the exact versions of Xcode that are preinstalled, refer to Microsoft-hosted agents. Bean app mac.
Create a file named azure-pipelines.yml in the root of your repository. Then, add the following snippet to your azure-pipelines.yml
file to select the appropriate agent pool:
Build an app with Xcode
To build an app with Xcode, add the following snippet to your azure-pipelines.yml
file. This is a minimal snippet for building an iOS project using its default scheme, for the Simulator, and without packaging. Change values to match your project configuration. See the Xcode task for more about these options.
Signing and provisioning
An Xcode app must be signed and provisioned to run on a device or be published to the App Store. The signing and provisioning process needs access to your P12 signing certificate and one or more provisioning profiles. The Install Apple Certificate and Install Apple Provisioning Profile tasks make these available to Xcode during a build.
The following snippet installs an Apple P12 certificate and provisioning profile in the build agent's Keychain. Then, it builds, signs, and provisions the app with Xcode. Finally, the certificate and provisioning profile are automatically removed from the Keychain at the end of the build, regardless of whether the build succeeded or failed. For more details, see Sign your mobile app during CI.
CocoaPods
If your project uses CocoaPods, you can run CocoaPods commands in your pipeline using a script, or with the CocoaPods task. The task optionally runs pod repo update
, then runs pod install
, and allows you to set a custom project directory. Following are common examples of using both.
Carthage
If your project uses Carthage with a private Carthage repository,you can set up authentication by setting an environment variable namedGITHUB_ACCESS_TOKEN
with a value of a token that has access to the repository.Carthage will automatically detect and use this environment variable.
Do not add the secret token directly to your pipeline YAML.Instead, create a new pipeline variable with its lock enabled on the Variables pane to encrypt this value.See secret variables.
Here is an example that uses a secret variable named myGitHubAccessToken
for the value of the GITHUB_ACCESS_TOKEN
environment variable.
Testing on Azure-hosted devices
Add the App Center Test task to test the app in a hosted lab of iOS and Android devices. An App Center free trial is required which must later be converted to paid.
Sign up with App Center first.
Retain artifacts with the build record
Add the Copy Files and Publish Build Artifacts tasksto store your IPA with the build record or test and deploy it in subsequent pipelines. See Artifacts.
Deploy
App Center
Add the App Center Distribute task to distribute an app to a group of testers or beta users,or promote the app to Intune or the Apple App Store. A free App Center account is required (no payment is necessary).
Apple App Store
Install the Apple App Store extensionand use the following tasks to automate interaction with the App Store. By default, these tasks authenticate to Appleusing a service connection that you configure.
Release
Xcode Build Location
Add the App Store Releasetask to automate the release of updates to existing iOS TestFlight beta apps or production apps in the App Store.
Build Macos App In Xcode Download
See limitationsof using this task with Apple two-factor authentication,since Apple authentication is region specific andfastlane session tokens expire quickly and must be recreated and reconfigured.
Promote
Add the App Store Promotetask to automate the promotion of a previously submitted app from iTunes Connect to the App Store.
Related extensions
Xcode Build Project
- Apple App Store (Microsoft)
- Codified Security (Codified Security)
- MacinCloud (Moboware Inc.)
- Mobile App Tasks for iOS and Android (James Montemagno)
- Mobile Testing Lab (Perfecto Mobile)
- Raygun (Raygun)
- React Native (Microsoft)
- Version Setter (Tom Gilder)