Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: separate build target for release build #1901

Merged
merged 5 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/build-release-weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
name: Build Unity Cloud
needs: get-info
uses: ./.github/workflows/build-unitycloud.yml
env:
IS_RELEASE_BUILD: true # This environment variable indicates a release build
TAG_VERSION: ${{ needs.get-info.outputs.tag_version }}
with:
profile: none
cache: false
Expand Down
12 changes: 10 additions & 2 deletions scripts/cloudbuild/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
# Local
import utils

# Force a build
# Define whether this is a release workflow based on IS_RELEASE_BUILD
is_release_workflow = os.getenv('IS_RELEASE_BUILD', 'false').lower() == 'true'

URL = utils.create_base_url(os.getenv('ORG_ID'), os.getenv('PROJECT_ID'))
HEADERS = utils.create_headers(os.getenv('API_KEY'))
Expand Down Expand Up @@ -58,7 +59,14 @@ def generate_body(template_target, name, branch, options, remoteCacheStrategy):
return body

# Set target name based on branch, without commit SHA
new_target_name = f'{re.sub(r'^t_', '', os.getenv('TARGET'))}-{re.sub('[^A-Za-z0-9]+', '-', os.getenv('BRANCH_NAME'))}'.lower()
base_target_name = f'{re.sub(r'^t_', '', os.getenv('TARGET'))}-{re.sub('[^A-Za-z0-9]+', '-', os.getenv('BRANCH_NAME'))}'.lower()

if is_release_workflow:
# Use the tag version in the target name if it's a release workflow
tag_version = os.getenv('TAG_VERSION', 'unknown-version')
new_target_name = f"{base_target_name}-{tag_version}"
else:
new_target_name = base_target_name

# Generate request body
# Disabled cache for now as its not playing well with Unity and we delete builds anyway!
Expand Down
Loading