Skip to content

unity-xcode-builder@v1.3.0 #345

unity-xcode-builder@v1.3.0

unity-xcode-builder@v1.3.0 #345

Workflow file for this run

name: validate
on:
push:
branches:
- 'main'
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
branches:
- '*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unity-build:
if: github.event.pull_request.draft == false
name: '(${{ matrix.unity-version }}) ${{ matrix.build-target }}'
env:
VERSION: ''
TEMPLATE_PATH: ''
UNITY_PROJECT_PATH: ''
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest]
unity-version: [6000]
build-target: [iOS, StandaloneOSX, VisionOS]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: 'npm install -g openupm-cli'
# Installs the Unity Editor based on your project version text file
# sets -> env.UNITY_EDITOR_PATH
# sets -> env.UNITY_PROJECT_PATH
- uses: RageAgainstThePixel/unity-setup@v1
with:
version-file: 'None'
build-targets: ${{ matrix.build-target }}
unity-version: ${{ matrix.unity-version }}
architecture: 'arm64'
- name: Find Unity Template Path and Version
shell: bash
run: |
rootPath=${UNITY_EDITOR_PATH/Editor*/}
echo "ROOT_PATH=$rootPath"
templatePath=$(find "$rootPath" -type f -name "com.unity.template.3d*.tgz" | head -n 1)
echo "TEMPLATE_PATH=$templatePath"
echo "TEMPLATE_PATH=$templatePath" >> $GITHUB_ENV
projectPath="${{ github.workspace }}/UnityProject"
echo "UNITY_PROJECT_PATH=$projectPath" >> $GITHUB_ENV
# Read version from package.json instead of git tags
packageJsonPath="${{ github.workspace }}/package.json"
version=$(jq -r '.version' "$packageJsonPath")
if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Version from package.json: $version"
else
echo "Version: $version is not a valid version string"
exit 1
fi
echo "VERSION=$version" >> $GITHUB_ENV
- uses: RageAgainstThePixel/activate-unity-license@v1
with:
license: 'Personal'
username: ${{ secrets.UNITY_USERNAME }}
password: ${{ secrets.UNITY_PASSWORD }}
- uses: RageAgainstThePixel/unity-action@v1
name: Create Test Project
with:
log-name: 'create-test-project'
args: '-quit -nographics -batchmode -createProject "${{ github.workspace }}/UnityProject" -cloneFromTemplate "${{ env.TEMPLATE_PATH }}"'
- run: openupm add com.utilities.buildpipeline
name: Add Build Pipeline Package
working-directory: ${{ github.workspace }}/UnityProject
- uses: RageAgainstThePixel/unity-action@v1
name: '${{ matrix.build-target }}-Validate'
with:
build-target: ${{ matrix.build-target }}
log-name: '${{ matrix.build-target }}-Validate'
args: '-quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject -importTMProEssentialsAsset'
- uses: RageAgainstThePixel/unity-action@v1
name: '${{ matrix.build-target }}-Build'
with:
build-target: ${{ matrix.build-target }}
log-name: '${{ matrix.build-target }}-Build'
args: '-quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild -sceneList Assets/Scenes/SampleScene.unity -export -enableAppleAutomaticSigning -bundleIdentifier com.rageagainstthepixel.xcode -versionName ${{ env.VERSION }}'
- uses: ./ # RageAgainstThePixel/unity-xcode-builder
id: xcode-build
with:
project-path: ${{ env.UNITY_PROJECT_PATH }}/Builds/${{ matrix.build-target }}/**/*.xcodeproj
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: app-store
- name: print outputs
if: always()
run: |
echo "Executable: ${{ steps.xcode-build.outputs.executable }}"
echo "Output Directory: ${{ steps.xcode-build.outputs.output-directory }}"
ls -R "${{ steps.xcode-build.outputs.output-directory }}"