Skip to content

only upload binaries if ad-hoc install #24

only upload binaries if ad-hoc install

only upload binaries if ad-hoc install #24

Workflow file for this run

# Generated by Buildalon. Generate another Unity build workflow at buildalon.com
# Feel free to edit this workflow to update build targets or add additional steps.
# Check out the Buildalon open source actions at https://github.com/marketplace?query=buildalon
name: Buildalon Unity Build
on:
push:
branches:
- 'main'
pull_request:
branches:
- '*'
workflow_dispatch:
inputs:
clean:
description: 'Cleans the library folder and deletes cached items'
required: false
default: false
type: 'boolean'
set-version:
type: string
default: ''
required: false
description: 'manually specify a version for the build'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ ( github.event_name == 'pull_request' || github.event.action == 'synchronize' ) }}
jobs:
build:
env:
VERSION: ''
SPLIT_APK: ''
BUILD_ARGS: ''
EXPORT_OPTION: ''
RELEASE_CHANNEL: ''
UNITY_EDITOR_PATH: ''
UNITY_PROJECT_PATH: ''
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-15]
include:
- os: windows-latest
build-target: Android
build-args: ''
- os: macos-15
build-target: VisionOS
build-args: ' -enableAppleAutomaticSigning'
steps:
- uses: actions/checkout@v4
with:
clean: ${{ github.event.inputs.clean == 'true' }}
- name: Update Version
run: |
# Update Version
$githubRefName = '${{ github.ref_name }}'
$isRelease = '${{ ( github.ref_name == 'main' || github.ref_name == 'development' ) && github.event_name == 'push' }}'
git fetch --all --tags
Write-Host "ref name $githubRefName"
$env:GIT_REDIRECT_STDERR = '2>&1'
$lastRelease = $(git describe --tags $(git rev-list --tags --max-count=1))
Write-Host "Last release from git: $lastRelease"
if ([string]::IsNullOrWhiteSpace($lastRelease) -or $lastRelease -match "fatal") {
$lastRelease = "0.0.0"
}
$lastReleaseSemVer = [System.Management.Automation.SemanticVersion]$lastRelease
$lastReleaseVersionString = $lastReleaseSemVer.ToString()
if ($isRelease -eq 'true') {
if ('${{ matrix.build-target }}' -eq 'Android') {
$split = " -splitApk"
"SPLIT_APK=$split" >> $env:GITHUB_ENV
}
$setVersion = '${{ inputs.set-version }}'
if ([string]::IsNullOrWhiteSpace($setVersion)) {
$isMain = '${{ github.ref_name == 'main' }}'
if ($isMain -eq 'true') {
$version = [System.Management.Automation.SemanticVersion]::New($lastReleaseSemVer.Major + 1, 0, 0)
} else {
$version = [System.Management.Automation.SemanticVersion]::New($lastReleaseSemVer.Major, $lastReleaseSemVer.Minor + 1, 0)
}
} else {
$version = [System.Management.Automation.SemanticVersion]$setVersion
}
} else {
$version = [System.Management.Automation.SemanticVersion]::New($lastReleaseSemVer.Major, $lastReleaseSemVer.Minor, $lastReleaseSemVer.Patch + 1, "preview.${{ github.run_number }}")
}
$versionString = $version.ToString()
Write-Host "Building Version $lastReleaseVersionString -> $versionString"
"VERSION=$versionString" >> $env:GITHUB_ENV
$releaseChannel = "BETA"
$exportOption = "ad-hoc"
if ($githubRefName -eq 'main') {
$releaseChannel = "RC"
$exportOption = "app-store"
}
Write-Host "Release Channel -> $releaseChannel"
"RELEASE_CHANNEL=$releaseChannel" >> $env:GITHUB_ENV
Write-Host "Export Option -> $exportOption"
"EXPORT_OPTION=$exportOption" >> $env:GITHUB_ENV
exit 0
shell: pwsh
- name: Update Build Args
run: |
$buildArgs = '${{ matrix.build-args }}'
$buildArgs += " -versionName ${{ env.VERSION }} -versionCode ${{ github.run_number }}"
Write-Host "Build Args: $buildArgs"
"BUILD_ARGS=$buildArgs" >> $env:GITHUB_ENV
shell: pwsh
- uses: buildalon/unity-setup@v1
with:
build-targets: '${{ matrix.build-target }}'
- uses: buildalon/activate-unity-license@v1
with:
license: 'Professional'
username: '${{ secrets.UNITY_USERNAME }}'
password: '${{ secrets.UNITY_PASSWORD }}'
serial: '${{ secrets.UNITY_SERIAL }}'
- uses: buildalon/unity-action@v1
name: Project Validation
with:
log-name: 'project-validation'
args: '-quit -batchmode -executeMethod Buildalon.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject'
- uses: buildalon/unity-action@v1
name: '${{ matrix.build-target }}-Build'
with:
log-name: '${{ matrix.build-target }}-Build'
build-target: '${{ matrix.build-target }}'
args: '-quit -batchmode -executeMethod Buildalon.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild${{ matrix.build-args }} -versionName 1.0.1'
- uses: RageAgainstThePixel/unity-xcode-builder@development
id: xcode-build
if: ${{ matrix.build-target == 'VisionOS' }}
with:
project-path: ${{ env.UNITY_PROJECT_PATH }}
app-store-connect-key: ${{ secrets.APP_STORE_CONNECT_KEY }}
app-store-connect-key-id: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
app-store-connect-issuer-id: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
team-id: ${{ secrets.APPLE_TEAM_ID }}
export-option: ${{ env.EXPORT_OPTION }}
- uses: buildalon/setup-ovr-platform-util@v1
if: ${{ matrix.build-target == 'Android' && ( github.ref_name == 'main' || github.ref_name == 'development' ) && github.event_name == 'push' }}
- uses: buildalon/upload-meta-quest-build@v1
if: ${{ matrix.build-target == 'Android' && ( github.ref_name == 'main' || github.ref_name == 'development' ) && github.event_name == 'push' }}
with:
appId: ${{ secrets.META_APP_ID }}
appSecret: ${{ secrets.META_APP_SECRET }}
ageGroup: TEENS_AND_ADULTS
- uses: actions/upload-artifact@v4
id: upload-artifact
name: 'Upload ${{ matrix.build-target }} Artifacts'
if: ${{ env.EXPORT_OPTION == 'ad-hoc' }}
with:
compression-level: 0
retention-days: 1
name: '${{ github.run_number }}.${{ github.run_attempt }}-${{ matrix.os }}-${{ matrix.build-target }}-Artifacts'
path: |
# ${{ github.workspace }}/**/*.log
${{ steps.xcode-build.outputs.executable }}
${{ env.UNITY_PROJECT_PATH }}/Builds/Android/**/*.obb
${{ env.UNITY_PROJECT_PATH }}/Builds/Android/**/*.apk
${{ env.UNITY_PROJECT_PATH }}/Builds/Android/**/*.abb
- name: Clean Artifacts
if: always()
shell: pwsh
run: |
# Clean Logs
Get-ChildItem -Path "${{ env.UNITY_PROJECT_PATH }}" -File -Filter "*.log" -Recurse | Remove-Item -Force
$artifacts = "${{ env.UNITY_PROJECT_PATH }}/Builds"
Write-Host "::debug::Build artifacts path: $artifacts"
if (Test-Path -Path $artifacts) {
try {
Remove-Item $artifacts -Recurse -Force
} catch {
Write-Warning "Failed to delete artifacts folder file: $_"
}
} else {
Write-Host "::debug::Artifacts folder not found."
}