How to Build for Appstore without Mac using Unity Cloud build

Not everyone has a Mac, duh! It doesn’t mean it should stop us from creating games for the App Store. I am creating this post as a go-to post for you and me to create a cloud-build setup for Unity iOS. It’s crazy how much pain this build can afflict on us. It’s easier to save some time by giving money to Unity to build it for us. Although I wish the build cost was cheaper 😅

There are 3 steps to this

Reusable Setup

This should be a reusable setup. In this step, we will generate some certificates and files which you should keep in a safe space. Ideally, on a cloud drive. I use OneDrive

Download OpenSSL from https://www.openssl.org/
Simply put, we will use this command line tool to generate keys and certificates for us
Open the terminal and cd to a folder where you will keep all the keys

Command to create RSA key (replace companyname.key with your key name)

openssl genrsa -out companyname.key 2048

Command to create certificate signing request (.csr). Fill in appropriate values that will be bundled with the csr. Use a password. Remember the password or better, save it in a text in the same folder.

openssl req -newkey rsa:2048 -keyout companyname.key -out companyname.csr

Go to Certificates in your Apple developer. Create a new certificate with Apple Distribution/Apple Development. Use the csr file that you created earlier. Download the distribution certificate. Keep it in the same folder

Command to create .pem file (prerequisite for .p12 file). If necessary replace distribution.cer or development.cer with the name of your .cer file

openssl x509 -in distribution.cer -inform DER -out mykey.pem -outform PEM

Command to create .p12 file. Use same password as the one used in csr generation. Use the same for the export password to keep things simple

openssl pkcs12 -export -inkey mykey.key -in mykey.pem -out mykey.p12

App Specific Setup

This is the set up you need to do for each app

Create app id for the game on the Identifier page. Use an explicit bundle id, same as the one in your project. Register

Create a Provisioning Profile from Profiles page. Select Appstore → Connect with App Id, Use the certificate that you created earlier. Use the game name as the Provisioning Profile Name. Generate and download. Keep it in the same folder

Unity Setup

In Unity, switch the platform to iOS.

Make sure Player Settings → Identification → Bundle Identifier is as expected

Import this post-build.bash script into the Assets folder.
This script will make sure that after Unity builds your project, it uploads the build to Appstore connect

[Optional] Make sure that you increase the build version with every build. You can use a build version processor script to avoid doing this pain in the *ss task. I have my version of this script

Unity Cloud Build Setup

Go to Unity Cloud Build

Create a new Project with your project name.

Go to Project → DevOps → Build Automation→ Settings → Source Control. Set Provider to GitHub. Create a Personal Access Token on your GitHub, authorize and use that. Select repo and save

Go to Project → DevOps → Build Automation→ Credentials. Add Credentials iOS. Name it to Project Name iOS and upload all the required files. Save

Go to Project → DevOps → Build Automation→ Configurations. Target Setup → iOS.
Set default branch → main (or your preferred one)
Unity version → Select the closest one or Auto Detect Unity version
Builder OS → macOS Ventura (or your preferred one)
Xcode version → your preferred one
Builder config: Standard (or your preferred one)
Fill in the Bundle ID and Credentials set
Turn all off on Scheduling (or schedule auto builds)
Save Configuration

Continue to Advanced Settings

Script hooks → Post-build script. Set it as Assets/post-build.bash
TARGET_NAME → default-ios
ITUNES_USERNAME → [use your Appstore email]
ITUNES_PASSWORD → [generate your app specific password]
Apply individually on each variable and then Save Changes

Build 🚀

That’s it. I hope it helps. If you need any further help, feel free to reach out.

Newsletter Updates

Enter your email address below to subscribe to our newsletter

Leave a Reply

Your email address will not be published. Required fields are marked *