Skip to content

Commit

Permalink
unity-xcode-builder@v1.0.0 (#1)
Browse files Browse the repository at this point in the history
- Initial Release! 🎉🚀
  • Loading branch information
StephenHodgson authored Sep 16, 2024
1 parent 572a71e commit 401b923
Show file tree
Hide file tree
Showing 16 changed files with 44,713 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @buildalon/buildalon
91 changes: 91 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: validate
on:
push:
branches:
- 'main'
pull_request:
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:
name: '(${{ matrix.unity-version }}) ${{ matrix.build-target }}'
env:
TEMPLATE_PATH: ''
UNITY_PROJECT_PATH: '' # set by unity-setup action
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13]
unity-version: [2021.x, 2022.x, 6000.x]
build-target:
- iOS
- StandaloneOSX
steps:
- uses: actions/checkout@v4
- 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: buildalon/unity-setup@v1
with:
version-file: 'None'
build-targets: ${{ matrix.build-target }}
unity-version: ${{ matrix.unity-version }}
- name: Find Unity Template Path
run: |
$rootPath = $env:UNITY_EDITOR_PATH -replace "Editor.*", ""
Write-Host "ROOT_PATH=$rootPath"
$templatePath = Get-ChildItem -Recurse -Filter "com.unity.template.3d*.tgz" -Path $rootPath | Select-Object -First 1 | Select-Object -ExpandProperty FullName
Write-Host "TEMPLATE_PATH=$templatePath"
echo "TEMPLATE_PATH=$templatePath" >> $env:GITHUB_ENV
$projectPath = "${{ github.workspace }}/UnityProject"
echo "UNITY_PROJECT_PATH=$projectPath" >> $env:GITHUB_ENV
shell: pwsh
# Activates the installation with the provided credentials
- uses: buildalon/activate-unity-license@v1
with:
license: 'Personal'
username: ${{ secrets.UNITY_USERNAME }}
password: ${{ secrets.UNITY_PASSWORD }}
- uses: buildalon/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.virtualmaker.buildalon'
name: Add Build Pipeline Package
working-directory: ${{ github.workspace }}/UnityProject
- uses: buildalon/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 Buildalon.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject -importTMProEssentialsAsset'
- uses: buildalon/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 Buildalon.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild -sceneList Assets/Scenes/SampleScene.unity -export -enableAppleAutomaticSigning -bundleIdentifier com.test.buildalon.xcode'

- uses: ./ # buildalon/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: ad-hoc

- name: print outputs
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 }}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Buildalon: Automate Unity
Copyright (c) 2024 Virtual Maker Corporation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
71 changes: 69 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,69 @@
# unity-xcode-builder
A GitHub Action to build Unity exported xcode projects.
# Buildalon unity-xcode-builder

A GitHub Action to build and archive Unity exported xcode projects.

> [!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.
## How to use

### workflow

```yaml
steps:
- uses: buildalon/unity-xcode-builder@v1
id: xcode-build
with:
project-path: '/path/to/your/build/output/directory'
app-store-connect-key: ${{ APP_STORE_CONNECT_KEY }}
app-store-connect-key-id: ${{ secrets.APP_STORE_CONNECT_KEY }}
app-store-connect-issuer-id: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
team-id: ${{ secrets.APPLE_TEAM_ID }}

- run: |
echo ${{ steps.xcode-build.outputs.executable }}
ls -al ${{ steps.xcode-build.outputs.output-directory }}
```
### inputs
This action requires several secrets that need to be setup in the repository or organization's action secret store.
- `APP_STORE_CONNECT_KEY`: The App Store Connect API AuthKey_*.p8 key encoded as base64 string.
- `APP_STORE_CONNECT_KEY_ID`: The App Store Connect API key id.
- `APP_STORE_CONNECT_ISSUER_ID`: The issuer ID of the App Store Connect API key.

> [!TIP]
> You can easily encode a file to base64 using the following command in linux, mac, or windows bash terminal:
>
> ```bash
> openssl base64 -in ./AuthKey_*.p8 -out ./AuthKey_*.txt
> ```

| name | description | required |
| ---- | ----------- | -------- |
| `xcode-version` | The version of Xcode to use for building the Xcode project. | Defaults to the [latest version of Xcode on the runner](https://github.com/actions/runner-images#available-images). |
| `project-path` | The directory that contains the exported xcode project from Unity. | Defaults to searching the workspace for `.xcodeproj` |
| `app-store-connect-key` | The App Store Connect API AuthKey_*.p8 key encoded as base64 string. | true |
| `app-store-connect-key-id` | The App Store Connect API key id. | true |
| `app-store-connect-issuer-id` | The issuer ID of the App Store Connect API key. | true |
| `certificate` | Exported signing certificate.p12 encoded as base64 string. Overrides the automatic signing in Xcode. | Defaults to Automatic signing. |
| `certificate-password` | The password for the exported certificate. | Required if `certificate` is provided. |
| `signing-identity` | The signing identity to use for signing the Xcode project. | Parsed from the `certificate` if not provided. |
| `provisioning-profile` | The provisioning profile to use as base64 string. Use when manually signing the Xcode project. | Defaults to Automatic signing. |
| `provisioning-profile-name` | The name of the provisioning profile file, including the type to use for signing the Xcode project. Must end with either `.mobileprovision` or `.provisionprofile`. | Required if `provisioning-profile` is provided. |
| `team-id` | The team ID to use for signing the Xcode project. | Defaults to parsing team ID from `certificate` if provided. |
| `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}'. |
| `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`. |

### outputs

- `executable`: Path to the exported archive executable.
- `output-directory`: The path to the export output directory.
77 changes: 77 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Buildalon unity-xcode-builder
description: A GitHub Action to build and archive Unity exported xcode projects.
branding:
icon: command
color: red
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.
required: false
project-path:
description: The directory that contains the exported xcode project from Unity.
required: true
app-store-connect-key:
description: The App Store Connect API AuthKey_*.p8 key encoded as base64 string.
required: true
app-store-connect-key-id:
description: The App Store Connect API key id.
required: true
app-store-connect-issuer-id:
description: The issuer ID of the App Store Connect API key.
required: true
certificate:
description: Exported signing certificate.p12 encoded as base64 string. Overrides the automatic signing in Xcode.
required: false
certificate-password:
description: The password for the exported certificate. Required if `certificate` is provided.
required: false
signing-identity:
description: The signing identity to use for signing the Xcode project. Parsed from the `certificate` if not provided.
required: false
provisioning-profile:
description: The provisioning profile to use as base64 string. Overrides the automatic signing in Xcode.
required: false
provisioning-profile-name:
description: The name of the provisioning profile file, including the type to use for signing the Xcode project. Required if `provisioning-profile` is provided. Must end with either `.mobileprovision` or `.provisionprofile`.
required: false
team-id:
description: The team ID to use for signing the Xcode project. Defaults to parsing team ID from `.xcodeproj`.
required: false
bundle-id:
description: The bundle ID of the Xcode project. Defaults to parsing bundle ID from `.xcodeproj`.
required: false
configuration:
description: The configuration to use when building the xcode project. Defaults to `Release`.
required: false
default: 'Release'
scheme:
description: The scheme to use when building the xcode project.
required: false
destination:
description: The destination to use when building the xcode project. Defaults to `generic/platform={platform}`.
required: false
platform:
description: The platform to build for. Can be one of `iOS`, `macOS`, `visionOS`, `tvOS`. Defaults to parsing platform from `.xcodeproj`.
required: false
export-option:
description: 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`.
required: false
default: development
export-option-plist:
description: The path to custom export option plist file to use when exporting the Xcode project. Overrides `export-option`.
required: false
entitlements-plist:
description: The path to custom entitlements plist file. Generates default hardened runtime entitlements if not provided.
required: false
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
outputs:
executable:
description: The path to the generated archive executable.
output-directory:
description: The path to the export output directory.
runs:
using: 'node20'
main: 'dist/index.js'
post: 'dist/index.js'
Loading

0 comments on commit 401b923

Please sign in to comment.