Version: 2021.2
Setting up Cloud Build
Using the Unity Developer Dashboard to configure Cloud Build for Mercurial

Using the Unity Developer Dashboard to configure Cloud Build for Git

Cloud Build supports projects stored in Git repositories. Your repository can be hosted on GitHub, GitLab, Bitbucket, or private servers.

This topic covers:

Configuring Git on the Dashboard

To configure Cloud Build to build your Project from a GitHub repository:

  1. Sign in to the Unity Developer Dashboard.
  2. On the ProjectsIn Unity, you use a project to design and develop a game. A project stores all of the files that are related to a game, such as the asset and Scene files. More info
    See in Glossary
    page, select your Project.
  3. Click DevOps > Cloud Build > Build History.
  4. In the Build History window, click Set up Cloud Build.

You can configure access to your repository using the following authorization protocols:

  • OAuth (default)
  • SSH

To configure Cloud Build to use OAuth to access your repository:

  1. In the Source Control window, click the GitHub, Bitbucket, or GitLab tile.
  2. Authorize access to your account as appropriate for the selected source code control service.
  3. In the Select a Repository window, choose a repository from which to build the Project and then click the NEXT: TARGET SETUP button.

Note: Cloud Build uses your current credentials to retrieve the repository list if you are currently signed into the source code management service. To configure a Project that retrieves a repository from a different account, sign out of the source code management service first, then configure the Project.

For the next step, see Setting up a target build platform.

To configure Cloud Build to use SSH to access your repository:

  1. In the Source Control window, click the Manual tab.

  2. In the SCM URL field, enter the URL of your Git server in either of the following formats:

    • Non-SSL: host:port
    • SSL: ssl:host:port
  3. To connect to your repository, you must specify the URL to your Git server. For information on the format of the URL, see URL syntax. Note: If you are hosting Git on a private server, you must use SSH to connect to your repository.

  4. From the SCM Type drop-down menu, select GIT.

  5. Click the NEXT: ACCESS button.

When Cloud Build connects to the hosting site, it automatically detects whether your repository is public or private. If your repository is public, Cloud Build automatically connects to it, and you can skip to Setting up a target build platform. If your repository is private, see the Using private repositories section.

URL syntax

To connect to your repository, you must specify the URL to your Git server. You can specify the URL to use the https:// protocol.

Note: Git has depricated the git:// URL. If you are connecting via SSH, there are new security steps. See Improving Git protocol security on GitHub for more information.

The following are examples of URLs for GitHub, bitbucket, and GitLab:

  • https://github.com/youraccount/yourrepo
  • git@bitbucket.org:youraccount/yourrepo.git
  • git@gitlab.com:youracccount/yourrepo.git

Note: If you are hosting Git on a private server, you must use SSH to connect to your repository.

Unity Cloud Build automatically re-writes the URL into the format it needs.

Using private repositories

If your repository is private, Cloud Build must use SSH to connect to it. When Cloud Build detects that the repository is private, it displays the Grant us access to your source control screen.

Setting your SSH key on GitHub

To add your SSH key to your project in GitHub:

  1. Sign in to GitHub.

  2. In the upper-right corner of any GitHub page, click your profile photo, then click Your profile.

  3. On your profile page, click Repositories, then click the name of your repository.

  4. In your repository, click the Settings tab.

  5. In the sidebar, click Deploy Keys, then click the Add deploy key button.

  6. In the Title textbox, type name to identify this key.

  7. In the Key field, paste in your public key from the Grant us access to your source control window, and then click the Add key button.

For more information on deploy keys, see Managing Deploy Keys in the GitHub documentation.

You can also add your SSH key to your GitHub account so that all repositories in your account are accessible to Cloud Build. For more information, see Adding a new SSH key to your GitHub account in the GitHub documentation.

Setting your SSH key on Bitbucket

To add your SSH key to your Bitbucket account:

  1. Log in to Bitbucket.

  2. Click your avatarAn interface for retargeting animation from one rig to another. More info
    See in Glossary
    in the lower left of the page.

  3. Click Bitbucket settings.

  4. On the Settings page, in the SECURITY section, click SSH Keys.

  5. In SSH Keys, click the Add key button.

  6. In the Label field, enter a recognizable name for the key (such as Unity Cloud BuildA continuous integration service for Unity projects that automates the process of creating builds on Unity’s servers. More info
    See in Glossary
    .)

  7. Paste the Unity Cloud Build SSH key from the Grant us access to your source control window into the Key field.

  8. Click Add Key.

On the Grant us access to your source control window, click Next: Target Setup.

Setting up a target build platform

In the dashboard, on the NEW BUILD TARGET: BASIC INFO window:

  1. In the Target Label field, enter a name for the build.

  2. If the root folder of your repository doesn’t contain your Assets and Project settingsA broad collection of settings which allow you to configure how Physics, Audio, Networking, Graphics, Input and many other areas of your project behave. More info
    See in Glossary
    , in the Project Subfolder field, enter the URL of the folder that contains your Assets and Project settings.

  3. From the Unity Version drop-down menu, select the version of Unity with which to build the Project.

  4. If you do not want the Project to automatically build whenever your repository is updated, click the Auto-build toggle to disable this feature.

If you are building for the iOSApple’s mobile operating system. More info
See in Glossary
or Android platforms, your next step is to enter credentials for the build. Click Next: Credentials. For all other platforms, click Next: Build to complete the configuration and start the initial build.

Android credentials

In the SIGNING CREDS window, provide the following information:

  • A Bundle ID to uniquely identify your app on the device and in Google Play Store.

  • Enter your Android keystoreAn Android system that lets you store cryptographic key entries for enhanced device security. More info
    See in Glossary
    credentials or select Auto Generated Debug Keystore to use a development keystore. For more information on Android keystores, see Android Keystore System.

iOS Credentials

In the iOS SIGNING CREDS window provide the following information:

  • A Bundle ID to uniquely identify your app on the device.

  • The Xcode version with which to build the app.

  • Enter your IOS credentials. For more information on iOS credentials, see Building for iOS.

Using Git submodules

If your project uses private Git submodules, make sure that the URLs present in your .gitmodules file uses the git@ syntax instead of https://.

For example:

  • git@github.com:youraccount/yourrepo.git (for GitHub)

  • git@bitbucket.org:youraccount/yourrepo.git (for Bitbucket)

  • git@gitlab.com:youracccount/yourrepo.git (for GitLab)


2018–07–16Page amended

Setting up Cloud Build
Using the Unity Developer Dashboard to configure Cloud Build for Mercurial