Prerequisites
Before continuing with the tutorial…
- Make sure you use GitHub
- Use Capacitor
- Your app is already deployed on Apple Store
- Desire to read 😆…
Using Ionic is optional, for Cordova it could work, but I didn’t try.
Important about the price
https://developer.apple.com/xcode-cloud/
The service is ‘free’ up to the limit.
You can see in the screenshot price and limits (prices as of the creation of the tutorial, they could undergo changes in the future)
🔴 Once warned of requirements and prices, if you like, we continue…
📣 In the post, we assume that we have the app created in Apple Store
Intro
To make Xcode build your Capacitor app, you need to set up a few things.
Package Preparation
Be sure to have your build command in your package.json
script.
Then add the sync:ios
command like below.
This step will make the post script work simply
Post clone script
This script will be run by Xcode cloud after the clone step
Save this file in the root of your project and name it ios/App/ci_scripts/ci_post_clone.sh
Then make this file executable with this command chmod +x ios/App/ci_scripts/ci_post_clone.sh
Create an Xcode workflow
Open Xcode (yes, to remove Xcode you need Xcode)
And go to this tab :
Click on create workflow, select your app, click next like below.
Click on Edit workflow on the left
Go to the environments tab and choose like below Mac 12.4 and check the proper option
Choose your start condition. If you use the same build as us, I suggest using Tag instead of branch, to avoid double build.
Set your env variable
Connect your GitHub account
Then enable and the workflow and commit your first change, you should see your build running in Xcode.
Build Processing
In Xcode Cloud, you are billed based on the minutes you have used for running your CI/CD workflow. From experience, it takes about 10–15 minutes before a build can be processed in the Apple Store.
For private projects, the estimated cost per build can go up to $0.008/min x 5 mins = $0.4, or more, depending on the configuration or dependencies of your project.
For Open-source projects, this shouldn’t be a problem at all. See pricing.