Skip to content

Commit 186dc00

Browse files
chore: migrate Unity Cloud Build orchestration to V2 API
The Unity DevOps Build Automation V1 API is being deprecated: - End of support: September 21, 2026 - Hard removal (HTTP 410): December 21, 2026 Changes: - Update base URL to https://build-automation.services.api.unity.com/v2/ - Replace single API key auth with Service Account KEY_ID + SECRET_KEY - Update GitHub Actions env vars to UNITY_CLOUD_KEY_ID and UNITY_CLOUD_SECRET_KEY Ref: https://support.unity.com/hc/en-us/articles/51178448254356
1 parent df35da1 commit 186dc00

3 files changed

Lines changed: 13 additions & 12 deletions

File tree

.github/workflows/build-unitycloud.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,8 @@ jobs:
567567
echo "🔧 Starting Unity Cloud Build attempt at $(date '+%Y-%m-%d %H:%M:%S')"
568568
python -u scripts/cloudbuild/build.py
569569
env:
570-
API_KEY: ${{ secrets.UNITY_CLOUD_API_KEY }}
570+
KEY_ID: ${{ secrets.UNITY_CLOUD_KEY_ID }}
571+
SECRET_KEY: ${{ secrets.UNITY_CLOUD_SECRET_KEY }}
571572
ORG_ID: ${{ secrets.UNITY_CLOUD_ORG_ID }}
572573
PROJECT_ID: ${{ secrets.UNITY_CLOUD_PROJECT_ID }}
573574
POLL_TIME: 60
@@ -935,7 +936,8 @@ jobs:
935936
- name: Cancel Unity Cloud build
936937
if: ${{ cancelled() || failure() }}
937938
env:
938-
API_KEY: ${{ secrets.UNITY_CLOUD_API_KEY }}
939+
KEY_ID: ${{ secrets.UNITY_CLOUD_KEY_ID }}
940+
SECRET_KEY: ${{ secrets.UNITY_CLOUD_SECRET_KEY }}
939941
ORG_ID: ${{ secrets.UNITY_CLOUD_ORG_ID }}
940942
PROJECT_ID: ${{ secrets.UNITY_CLOUD_PROJECT_ID }}
941943
run: python -u scripts/cloudbuild/build.py --cancel || true

scripts/cloudbuild/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def _extract_member(self, member, targetpath, pwd):
3939
is_release_workflow = os.getenv('IS_RELEASE_BUILD', 'false').lower() == 'true'
4040

4141
URL = utils.create_base_url(os.getenv('ORG_ID'), os.getenv('PROJECT_ID'))
42-
HEADERS = utils.create_headers(os.getenv('API_KEY'))
42+
HEADERS = utils.create_headers(os.getenv('KEY_ID'), os.getenv('SECRET_KEY'))
4343

4444
POLL_TIME = int(os.getenv('POLL_TIME', '60'))
4545
QUEUE_POLL_TIME = int(os.getenv('QUEUE_POLL_TIME', '120'))

scripts/cloudbuild/utils.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
BUILD_INFO_PATH = os.path.join(DIR, 'build_info.json')
77

88
def create_base_url(org, project):
9-
return f'https://build-api.cloud.unity3d.com/api/v1/orgs/{org}/projects/{project}'
9+
return f'https://build-automation.services.api.unity.com/v2/orgs/{org}/projects/{project}'
1010

11-
def create_headers(api_key):
12-
# Encoding API key in Base64 format
13-
credentials = f"{api_key}:"
11+
def create_headers(key_id, secret_key):
12+
credentials = f"{key_id}:{secret_key}"
1413
encoded_credentials = base64.b64encode(credentials.encode('utf-8')).decode('utf-8')
15-
14+
1615
return {
1716
'Authorization': f'Basic {encoded_credentials}',
1817
'Content-Type': 'application/json'
@@ -23,15 +22,15 @@ def persist_build_info(target, id):
2322
'target': target,
2423
'id': id
2524
}
26-
25+
2726
with open(BUILD_INFO_PATH, 'w') as file:
2827
json.dump(data, file)
29-
28+
3029
def read_build_info():
3130
if not os.path.exists(BUILD_INFO_PATH):
3231
print('No build_info file found!')
3332
return None
34-
33+
3534
with open(BUILD_INFO_PATH, 'r') as file:
3635
data = json.load(file)
3736

@@ -43,4 +42,4 @@ def delete_build_info():
4342
return
4443

4544
os.remove(BUILD_INFO_PATH)
46-
print('build_info file deleted')
45+
print('build_info file deleted')

0 commit comments

Comments
 (0)