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

[email protected] #6

Merged
merged 2 commits into from
Oct 17, 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
37 changes: 27 additions & 10 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,27 @@ jobs:
unity-build:
name: '(${{ matrix.unity-version }}) ${{ matrix.build-target }}'
env:
VERSION: ''
TEMPLATE_PATH: ''
UNITY_PROJECT_PATH: '' # set by unity-setup action
UNITY_PROJECT_PATH: ''
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13]
unity-version: [2021.x, 2022.x, 6000.x]
os: [macos-15]
unity-version: [2021.x, 2022.3.x, 6000.x]
build-target:
- iOS
- StandaloneOSX
- VisionOS
exclude:
- os: macos-15
unity-version: 2021.x
build-target: 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
Expand All @@ -37,7 +45,8 @@ jobs:
version-file: 'None'
build-targets: ${{ matrix.build-target }}
unity-version: ${{ matrix.unity-version }}
- name: Find Unity Template Path
architecture: 'arm64'
- name: Find Unity Template Path and Version
run: |
$rootPath = $env:UNITY_EDITOR_PATH -replace "Editor.*", ""
Write-Host "ROOT_PATH=$rootPath"
Expand All @@ -46,8 +55,16 @@ jobs:
echo "TEMPLATE_PATH=$templatePath" >> $env:GITHUB_ENV
$projectPath = "${{ github.workspace }}/UnityProject"
echo "UNITY_PROJECT_PATH=$projectPath" >> $env:GITHUB_ENV
$version = $(git tag --sort=-v:refname) | Select-Object -First 1
$version = $version.Substring(1)
if ($version -match '^\d+\.\d+\.\d+$') {
Write-Host "Version: $version"
} else {
Write-Host "Version: $version is not a valid version string"
exit 1
}
echo "VERSION=$version" >> $env:GITHUB_ENV
shell: pwsh
# Activates the installation with the provided credentials
- uses: buildalon/activate-unity-license@v1
with:
license: 'Personal'
Expand All @@ -58,7 +75,7 @@ jobs:
with:
log-name: 'create-test-project'
args: '-quit -nographics -batchmode -createProject "${{ github.workspace }}/UnityProject" -cloneFromTemplate "${{ env.TEMPLATE_PATH }}"'
- run: 'openupm add com.virtualmaker.buildalon'
- run: openupm add com.virtualmaker.buildalon
name: Add Build Pipeline Package
working-directory: ${{ github.workspace }}/UnityProject
- uses: buildalon/unity-action@v1
Expand All @@ -72,8 +89,7 @@ jobs:
with:
build-target: ${{ matrix.build-target }}
log-name: '${{ matrix.build-target }}-Build'
args: '-quit -nographics -batchmode -executeMethod Buildalon.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild -sceneList Assets/Scenes/SampleScene.unity -export -enableAppleAutomaticSigning -bundleIdentifier com.test.buildalon.xcode'

args: '-quit -nographics -batchmode -executeMethod Buildalon.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild -sceneList Assets/Scenes/SampleScene.unity -export -enableAppleAutomaticSigning -bundleIdentifier com.test.buildalon.xcode -versionName ${{ env.VERSION }}'
- uses: ./ # buildalon/unity-xcode-builder
id: xcode-build
with:
Expand All @@ -82,9 +98,10 @@ jobs:
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: ad-hoc

export-option: app-store
upload: ${{ matrix.unity-version == '6000.x' }}
- name: print outputs
if: always()
run: |
echo "Executable: ${{ steps.xcode-build.outputs.executable }}"
echo "Output Directory: ${{ steps.xcode-build.outputs.output-directory }}"
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

[![Discord](https://img.shields.io/discord/939721153688264824.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/VM9cWJ9rjH) [![marketplace](https://img.shields.io/static/v1?label=&labelColor=505050&message=Buildalon%20Actions&color=FF1E6F&logo=github-actions&logoColor=0076D6)](https:/marketplace?query=buildalon) [![validate](https:/buildalon/unity-xcode-builder/actions/workflows/validate.yml/badge.svg?branch=main)](https:/buildalon/unity-xcode-builder/actions/workflows/validate.yml)

A GitHub Action to build and archive Unity exported xcode projects.
A GitHub Action to take Unity exported Xcode projects and automate the process of building, signing, archiving, notarizing, and uploading to Apple App Store Connect or Steam.

> [!NOTE]
> The main goal of this action to to take what is provided from Unity, archive, sign, notarize and package it to be directly uploaded to the Apple app store or steam.
> Steam uploads require an additional action step: [`upload-steam`](https:/buildalon/upload-steam)

## How to use

### workflow

To archive, export, and upload directly to Apple App Store Connect, use the following workflow configuration:

```yaml
steps:
- uses: buildalon/unity-xcode-builder@v1
Expand Down Expand Up @@ -58,12 +60,14 @@ This action requires several secrets that need to be setup in the repository or
| `bundle-id` | The bundle ID of the Xcode project. Overrides the value in the exported Unity project. | Defaults to parsing bundle ID from `.xcodeproj`. |
| `configuration` | The configuration to build the Xcode project with. | Defaults to `Release`. |
| `scheme` | The scheme to use when building the xcode project. | false |
| `destination` | The destination to use when building the xcode project. | Defaults to `generic/platform={platform}`. |
| `destination` | The destination to use when building the xcode project. | Defaults to 'generic/platform={platform}'. |
| `platform` | The platform to build for. Can be one of `iOS`, `macOS`, `tvOS`, `visionOS`. | Defaults to parsing platform from `.xcodeproj`. |
| `export-option` | The export option to use for exporting the Xcode project. Can be one of `app-store`, `steam`, `ad-hoc`, `package`, `enterprise`, `development`, `developer-id`, `mac-application`. | Defaults to `development` |
| `export-option-plist` | The path to custom export option plist file to use when exporting the Xcode project. | Overrides `export-option`. |
| `entitlements-plist` | The path to custom entitlements plist file. | Generates [default hardened runtime entitlements](https://developer.apple.com/documentation/security/hardened-runtime) if not provided. |
| `notarize` | Whether to notarize the exported Xcode project. | Defaults to `true` if `export-option === steam`. |
| `notarize` | Whether to notarize the exported Xcode project. | Defaults to `true` if `export-option !== app-store`. |
| `upload` | Whether to upload the exported Xcode project to App Store Connect. | Defaults to `true` if `export-option === app-store`. |
| `whats-new` | When `uploading === true`, Let your testers know what you would like them to test in this build. This information will be available to testers in all groups who have access to this build. | Defaults to the last git commit sha, current branch name, and commit message. |

### outputs

Expand Down
12 changes: 9 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Buildalon unity-xcode-builder
description: A GitHub Action to build and archive Unity exported xcode projects.
name: unity-xcode-builder
description: A GitHub Action to build, archive, and upload Unity exported xcode projects.
branding:
icon: command
color: red
color: blue
inputs:
xcode-version:
description: The version of Xcode to use for building the Xcode project. Defaults to the active version of Xcode on the runner.
Expand Down Expand Up @@ -66,6 +66,12 @@ inputs:
notarize:
description: Whether to notarize the exported Xcode project. Apps to be uploaded to Steam must be notarized by Apple. Defaults to `true` if `export-option === steam`.
required: false
upload:
description: Whether to upload the exported Xcode project to App Store Connect. Defaults to `true` if `export-option === app-store`.
required: false
whats-new:
description: 'When `uploading === true`, Let your testers know what you would like them to test in this build. This information will be available to testers in all groups who have access to this build. Defaults to the last git commit sha, current branch name, and commit message.'
required: false
outputs:
executable:
description: The path to the generated archive executable.
Expand Down
Loading
Loading