Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: condensereality/UnityCloudBuildAction
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: InfraWay/UnityCloudBuildAction
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 6 commits
  • 2 files changed
  • 1 contributor

Commits on Aug 13, 2024

  1. Copy the full SHA
    f022795 View commit details
  2. do set_build_target_env_var

    mihma committed Aug 13, 2024
    Copy the full SHA
    5934e2d View commit details
  3. update class UnityCloudBuilder

    mihma committed Aug 13, 2024
    Copy the full SHA
    7ee9d8c View commit details
  4. test set_build_target_env_var

    mihma committed Aug 13, 2024
    Copy the full SHA
    1bfc895 View commit details
  5. rollback

    mihma committed Aug 13, 2024
    Copy the full SHA
    86d64b1 View commit details

Commits on Aug 21, 2024

  1. Copy the full SHA
    41e7807 View commit details
Showing with 32 additions and 19 deletions.
  1. +10 −1 action.py
  2. +22 −18 action.yaml
11 changes: 10 additions & 1 deletion action.py
Original file line number Diff line number Diff line change
@@ -304,6 +304,7 @@ class UnityCloudBuilder:
def __init__(
self,
client: UnityCloudClient,
org_id: str,
project_id: str,
primary_build_target: str,
branch_and_label: BranchAndLabel
@@ -317,6 +318,8 @@ def __init__(
if not branch_and_label:
raise Exception(f"Missing branch_and_label. required")

self.api_base_url = "https://build-api.cloud.unity3d.com/api/v1"
self.org_id = org_id.lower()
self.project_id = project_id
self.primary_build_target = primary_build_target
self.branch_and_label = branch_and_label
@@ -415,7 +418,7 @@ def create_new_build_target(self,build_target_name:str) -> str:
if new_target_meta["post_request_response_status_code"] == 500:
error = new_target_meta["error"]
if error == "Build target name already in use for this project!":
logger.info(f"Build target for this branch already exists: {new_target_name}. Re-using...")
logger.info(f"Build target for this branch already exists: {build_target_name}. Re-using...")
else:
raise Exception(f"New target had error: {error}")

@@ -534,6 +537,7 @@ def wait_for_successfull_build(client: UnityCloudClient, project_id:str, build_t
@click.option("--org_id", envvar="UNITY_CLOUD_BUILD_ORG_ID", type=str)
@click.option("--project_id", envvar="UNITY_CLOUD_BUILD_PROJECT_ID", type=str)
@click.option("--primary_build_target", envvar="UNITY_CLOUD_BUILD_PRIMARY_TARGET", type=str)
@click.option("--build_profile", envvar="UNITY_CLOUD_BUILD_PROFILE_ENV", type=str)
@click.option(
"--polling_interval",
envvar="UNITY_CLOUD_BUILD_POLLING_INTERVAL",
@@ -566,6 +570,7 @@ def main(
org_id: str,
project_id: str,
primary_build_target: str,
build_profile: str,
polling_interval: float,
download_binary: bool,
github_branch_ref: str,
@@ -629,6 +634,7 @@ def main(

builder: UnityCloudBuilder = UnityCloudBuilder(
client,
org_id,
project_id,
primary_build_target,
branch_and_label
@@ -663,6 +669,9 @@ def main(
# this will create a new target if it doesnt exist
build_meta = builder.get_build_target_meta( allow_new_target )

# create a new env for the specified build target
builder_env = builder.set_build_target_env_var(build_target_name, "buildProfile", build_profile)

# create a new build for the specified build target
build_number = builder.start_build(build_target_name)
logger.info(f"Started build number {build_number} on {build_target_name}")
40 changes: 22 additions & 18 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,55 @@
name: 'Run Unity Cloud Build'
author: 'Condense <hello@condense.live>'
description: 'Runs relevant build via Unity Cloud Build'
name: "Run Unity Cloud Build"
author: "Condense <hello@condense.live>"
description: "Runs relevant build via Unity Cloud Build"
inputs:
unity_cloud_build_api_key:
description: 'Unity Cloud Build API key'
description: "Unity Cloud Build API key"
required: true
unity_cloud_build_org_id:
description: 'Unity Cloud Build Org ID'
description: "Unity Cloud Build Org ID"
required: true
unity_cloud_build_project_id:
description: 'Unity Cloud Build Project ID'
description: "Unity Cloud Build Project ID"
required: true
unity_cloud_build_polling_interval:
description: 'Interval to poll Unity Cloud Build'
description: "Interval to poll Unity Cloud Build"
required: false
default: '60'
default: "60"
unity_cloud_build_primary_target:
description: 'Unity Cloud Build Primary Target ID'
description: "Unity Cloud Build Primary Target ID"
required: true
unity_cloud_build_profile_env:
description: "Unity Cloud buildProfile environment variable"
required: true
unity_cloud_build_download_binary:
description: 'Download the build binary to env.ARTIFACT_FILEPATH'
description: "Download the build binary to env.ARTIFACT_FILEPATH"
required: false
unity_cloud_build_create_share:
description: 'Create a sharing url in UnityCloudBuild and output to env.SHARE_URL'
description: "Create a sharing url in UnityCloudBuild and output to env.SHARE_URL"
required: false
unity_cloud_build_use_existing_build_number:
description: 'Force the process to use an existing build number instead of starting a new build'
description: "Force the process to use an existing build number instead of starting a new build"
required: false
unity_cloud_build_github_branch_ref:
description: 'github branch reference to build (github.ref). This will create new build targets if the branch differs from the default target, to support pull requests and tags'
description: "github branch reference to build (github.ref). This will create new build targets if the branch differs from the default target, to support pull requests and tags"
required: true
unity_cloud_build_github_head_ref:
description: 'github.head_ref; only on pull requests and is the source branch; https://docs.github.com/en/actions/learn-github-actions/contexts'
description: "github.head_ref; only on pull requests and is the source branch; https://docs.github.com/en/actions/learn-github-actions/contexts"
required: false
unity_cloud_build_allow_new_target:
description: 'Set this to false to disable creation of new build targets/configurations based on the primary target.'
description: "Set this to false to disable creation of new build targets/configurations based on the primary target."
required: false

runs:
using: 'docker'
image: 'Dockerfile'
using: "docker"
image: "Dockerfile"
env:
UNITY_CLOUD_BUILD_API_KEY: ${{ inputs.unity_cloud_build_api_key }}
UNITY_CLOUD_BUILD_ORG_ID: ${{ inputs.unity_cloud_build_org_id }}
UNITY_CLOUD_BUILD_PROJECT_ID: ${{ inputs.unity_cloud_build_project_id }}
UNITY_CLOUD_BUILD_POLLING_INTERVAL: ${{ inputs.unity_cloud_build_polling_interval }}
UNITY_CLOUD_BUILD_PRIMARY_TARGET: ${{ inputs.unity_cloud_build_primary_target }}
UNITY_CLOUD_BUILD_PROFILE_ENV: ${{ inputs.unity_cloud_build_profile_env }}
UNITY_CLOUD_BUILD_DOWNLOAD_BINARY: ${{ inputs.unity_cloud_build_download_binary }}
UNITY_CLOUD_BUILD_CREATE_SHARE: ${{ inputs.unity_cloud_build_create_share }}
UNITY_CLOUD_BUILD_USE_EXISTING_BUILD_NUMBER: ${{ inputs.unity_cloud_build_use_existing_build_number }}