18
2021
Run Unity Cloud Build based on Github Commit message using Github Actions
This should had been easy, but unity cloud build system has every secret id hidden in different places and using different names..
- Create github action (click Actions from your repository)
- click “Skip this and set up a workflow yourself”
- copy ready to use script from: https://github.com/unitycoder/UnityCloudBuildGithubActions/blob/main/.github/workflows/main.yml
- you can modify “branches: [ main ]” if you are not using “main” branch
- you can modify the required commit messages, for android its the: “#BUILD_ANDROID”
- you can modify the required commit messages, for ios its the: “#BUILD_IOS”
- Add secrets to your repo Settings/Secrets
- collect secret keys from https://dashboard.unity3d.com , If you are invited as a collaborator check https://dashboard.unity3d.com/settings/account/guest-projects
- Select your cloud project
- get API_KEY from Devops/Settings page (at API Settings row)
- PROJECT_ID from Project/Settings page (top bar, settings icon next to project name)
- ORG_ID from your current dashboard (when viewing project). Looks something like https://dashboard.unity3d.com/organizations/[ORGIDHERE]/projects/..
- BUILD_TARGET_ID_ANDROID its from DevOps/Config/, those targets that you have deviced there. Click Basic info, its the “Target name:” row, this is actually Build Target ID (but unity named it as “Target name”) and for some reason it defaults to some bad id, like “Default Android”.
- Repeat for IOS if need it (or remove from script)
- Note: make it lower case, and replace spaces with – (minus), so “Default Android” becomes “default-android”
- Note: You can change this id by clicking that blue “edit basic info” link below the opened basic info panel. (not the top panel where it shows “basic info” in title)
- From “Edit Basic Info” you can now also disable [x] Auto Build (this would build on every commit), and set correct Branch if needed.
- Now make a commit on main branch, with commit message that includes “#BUILD_ANDROID”, then check from Cloud Build system that build gets started (can take less than 1 minute)
Script info:
// this line checks if commit message contains #BUILD_ANDROID string and only then it runs the curl POST messageif [[ "${{ github.event.commits[0].message }}" == "#BUILD_ANDROID" ]];
Errors:*1{"error":"Not authorized. User does not have correct permissions to perform this operation."}
Check your Secrets, probably bad ORG_ID.
{"error":"The requested object was not found."}
Check that your secret variables are correct name in the script (if secret is “BUILD_TARGET_ID”, maybe in the script you have “BUILD_TARGET_ID_ANDROID” ?)
*1: You can view log output from Actions/ All Workflows / click the action (has commit message and with green checkmark next to it), then click “build” (this job name was set in the actions script), then click “Run multi-line script”, to open that task log.






Related Posts
5 Comments + Add Comment
Leave a comment
Recent posts
- Favorites in PackageManager
- LudumDare59 : Signal
- Unity Editor: Tree Generator
- Leaf/Foliage Generator Tools (Runs in Browser)
- Testing Unity AI Beta
- Ways to Support UnityCoder Development
- Using UI Slider to Create 5-Star Rating Element
- Game Music Library For Unity (editor plugin)
- Fontastic : Easily Test Fonts in Unity Editor!
- GeoTiff Importer & Terrain Generator for Unity
- Create Baked DropShadow for UI images
- .JP2 Ortho Image Converter to PNG/JPG/TIFF
Recent Comments
- on Mesh Exploder (sources)
- on Sprite Sheet Flip Book Shader
- on Sprite Sheet Flip Book Shader
- on [Asset Store] PolygonCollider2D Optimizer
- on Trajectory Test Scene 2.0
- on Vector3 maths for dummies!
- on UnityHub 3.6.0: Remove Version Control & Cloud Dashboard columns
- on Using RenderDoc with Unity (graphics debugger)
Coin:
CUgDSbRqFcAumDSAcdKDvuXsw26VdkJe8C8WGUQHBAGS
An article by












GitHub action to retrieve a Unity project’s bundleVersion
https://github.com/KageKirin/get-unity-bundle-version
php scripts for custom webhooks
https://www.triplustutorials.be/codeexamples/share-your-unity-games-url-every-build/
It’s nice. Thanks.
tutorials on CI (Continuous Integration) using Unity and GitHub Actions
https://github.com/mackysoft/Unity-GitHubActions-Tutorials
Unity Addressables Post Build Script to upload to a server
https://forum.unity.com/threads/unity-addressables-post-build-script-to-upload-to-a-server.1149314/#post-7381676