Skip to content

Commit 545cee2

Browse files
unity-xcode-builder@v1.0.0 (#1)
- Initial Release! 🎉🚀
1 parent 19eaece commit 545cee2

File tree

12 files changed

+44262
-34
lines changed

12 files changed

+44262
-34
lines changed

.github/workflows/validate.yml

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,80 @@ concurrency:
1212
group: ${{ github.workflow }}-${{ github.ref }}
1313
cancel-in-progress: true
1414
jobs:
15-
validate:
15+
unity-build:
16+
name: '(${{ matrix.unity-version }}) ${{ matrix.build-target }}'
17+
env:
18+
TEMPLATE_PATH: ''
19+
UNITY_PROJECT_PATH: '' # set by unity-setup action
1620
runs-on: ${{ matrix.os }}
1721
strategy:
1822
fail-fast: false
1923
matrix:
20-
os: [ubuntu-latest, windows-latest, macos-latest ]
24+
os: [macos-13]
25+
unity-version: [2021.x, 2022.x, 6000.x]
26+
build-target:
27+
- iOS
28+
- StandaloneOSX
2129
steps:
2230
- uses: actions/checkout@v4
23-
- run: echo "hello world"
31+
- run: 'npm install -g openupm-cli'
32+
# Installs the Unity Editor based on your project version text file
33+
# sets -> env.UNITY_EDITOR_PATH
34+
# sets -> env.UNITY_PROJECT_PATH
35+
- uses: RageAgainstThePixel/unity-setup@v1
36+
with:
37+
version-file: 'None'
38+
build-targets: ${{ matrix.build-target }}
39+
unity-version: ${{ matrix.unity-version }}
40+
- name: Find Unity Template Path
41+
run: |
42+
$rootPath = $env:UNITY_EDITOR_PATH -replace "Editor.*", ""
43+
Write-Host "ROOT_PATH=$rootPath"
44+
$templatePath = Get-ChildItem -Recurse -Filter "com.unity.template.3d*.tgz" -Path $rootPath | Select-Object -First 1 | Select-Object -ExpandProperty FullName
45+
Write-Host "TEMPLATE_PATH=$templatePath"
46+
echo "TEMPLATE_PATH=$templatePath" >> $env:GITHUB_ENV
47+
$projectPath = "${{ github.workspace }}/UnityProject"
48+
echo "UNITY_PROJECT_PATH=$projectPath" >> $env:GITHUB_ENV
49+
shell: pwsh
50+
# Activates the installation with the provided credentials
51+
- uses: RageAgainstThePixel/activate-unity-license@v1
52+
with:
53+
license: 'Personal'
54+
username: ${{ secrets.UNITY_USERNAME }}
55+
password: ${{ secrets.UNITY_PASSWORD }}
56+
- uses: RageAgainstThePixel/unity-action@v1
57+
name: Create Test Project
58+
with:
59+
log-name: 'create-test-project'
60+
args: '-quit -nographics -batchmode -createProject "${{ github.workspace }}/UnityProject" -cloneFromTemplate "${{ env.TEMPLATE_PATH }}"'
61+
- run: 'openupm add com.utilities.buildpipeline'
62+
name: Add Build Pipeline Package
63+
working-directory: ${{ github.workspace }}/UnityProject
64+
- uses: RageAgainstThePixel/unity-action@v1
65+
name: '${{ matrix.build-target }}-Validate'
66+
with:
67+
build-target: ${{ matrix.build-target }}
68+
log-name: '${{ matrix.build-target }}-Validate'
69+
args: '-quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject -importTMProEssentialsAsset'
70+
- uses: RageAgainstThePixel/unity-action@v1
71+
name: '${{ matrix.build-target }}-Build'
72+
with:
73+
build-target: ${{ matrix.build-target }}
74+
log-name: '${{ matrix.build-target }}-Build'
75+
args: '-quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild -sceneList Assets/Scenes/SampleScene.unity -export -enableAppleAutomaticSigning -bundleIdentifier com.rageagainstthepixel.xcode'
76+
77+
- uses: ./ # RageAgainstThePixel/unity-xcode-builder
78+
id: xcode-build
79+
with:
80+
project-path: ${{ env.UNITY_PROJECT_PATH }}/Builds/${{ matrix.build-target }}/**/*.xcodeproj
81+
app-store-connect-key: ${{ secrets.APP_STORE_CONNECT_KEY }}
82+
app-store-connect-key-id: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
83+
app-store-connect-issuer-id: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
84+
team-id: ${{ secrets.APPLE_TEAM_ID }}
85+
export-option: ad-hoc
86+
87+
- name: print outputs
88+
run: |
89+
echo "Executable: ${{ steps.xcode-build.outputs.executable }}"
90+
echo "Output Directory: ${{ steps.xcode-build.outputs.output-directory }}"
91+
ls -R "${{ steps.xcode-build.outputs.output-directory }}"

README.md

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,69 @@
1-
# github-action-template
1+
# unity-xcode-builder
22

3-
A GitHub Actions template repository for TypeScript based Actions.
3+
A GitHub Action to build and archive Unity exported xcode projects.
4+
5+
> [!NOTE]
6+
> 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.
47
58
## How to use
69

710
### workflow
811

912
```yaml
1013
steps:
11-
- uses: RageAgainstThePixel/github-action-template@v1
14+
- uses: RageAgainstThePixel/unity-xcode-builder@v1
15+
id: xcode-build
16+
with:
17+
project-path: '/path/to/your/build/output/directory'
18+
app-store-connect-key: ${{ APP_STORE_CONNECT_KEY }}
19+
app-store-connect-key-id: ${{ secrets.APP_STORE_CONNECT_KEY }}
20+
app-store-connect-issuer-id: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
21+
team-id: ${{ secrets.APPLE_TEAM_ID }}
22+
23+
- run: |
24+
echo ${{ steps.xcode-build.outputs.executable }}
25+
ls -al ${{ steps.xcode-build.outputs.output-directory }}
1226
```
1327
1428
### inputs
1529
30+
This action requires several secrets that need to be setup in the repository or organization's action secret store.
31+
32+
- `APP_STORE_CONNECT_KEY`: The App Store Connect API AuthKey_*.p8 key encoded as base64 string.
33+
- `APP_STORE_CONNECT_KEY_ID`: The App Store Connect API key id.
34+
- `APP_STORE_CONNECT_ISSUER_ID`: The issuer ID of the App Store Connect API key.
35+
36+
> [!TIP]
37+
> You can easily encode a file to base64 using the following command in linux, mac, or windows bash terminal:
38+
>
39+
> ```bash
40+
> openssl base64 -in ./AuthKey_*.p8 -out ./AuthKey_*.txt
41+
> ```
42+
1643
| name | description | required |
1744
| ---- | ----------- | -------- |
18-
| .... | ........... | ........ |
45+
| `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). |
46+
| `project-path` | The directory that contains the exported xcode project from Unity. | Defaults to searching the workspace for `.xcodeproj` |
47+
| `app-store-connect-key` | The App Store Connect API AuthKey_*.p8 key encoded as base64 string. | true |
48+
| `app-store-connect-key-id` | The App Store Connect API key id. | true |
49+
| `app-store-connect-issuer-id` | The issuer ID of the App Store Connect API key. | true |
50+
| `certificate` | Exported signing certificate.p12 encoded as base64 string. Overrides the automatic signing in Xcode. | Defaults to Automatic signing. |
51+
| `certificate-password` | The password for the exported certificate. | Required if `certificate` is provided. |
52+
| `signing-identity` | The signing identity to use for signing the Xcode project. | Parsed from the `certificate` if not provided. |
53+
| `provisioning-profile` | The provisioning profile to use as base64 string. Use when manually signing the Xcode project. | Defaults to Automatic signing. |
54+
| `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. |
55+
| `team-id` | The team ID to use for signing the Xcode project. | Defaults to parsing team ID from `certificate` if provided. |
56+
| `bundle-id` | The bundle ID of the Xcode project. Overrides the value in the exported Unity project. | Defaults to parsing bundle ID from `.xcodeproj`. |
57+
| `configuration` | The configuration to build the Xcode project with. | Defaults to `Release`. |
58+
| `scheme` | The scheme to use when building the xcode project. | false |
59+
| `destination` | The destination to use when building the xcode project. | Defaults to 'generic/platform={platform}'. |
60+
| `platform` | The platform to build for. Can be one of `iOS`, `macOS`, `tvOS`, `visionOS`. | Defaults to parsing platform from `.xcodeproj`. |
61+
| `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` |
62+
| `export-option-plist` | The path to custom export option plist file to use when exporting the Xcode project. | Overrides `export-option`. |
63+
| `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. |
64+
| `notarize` | Whether to notarize the exported Xcode project. | Defaults to `true` if `export-option === steam`. |
1965

2066
### outputs
67+
68+
- `executable`: Path to the exported archive executable.
69+
- `output-directory`: The path to the export output directory.

action.yml

Lines changed: 74 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,77 @@
1-
name: github-action-template
2-
description: 'A GitHub Actions template repository for JavaScript based Actions'
3-
# inputs:
4-
# outputs:
1+
name: unity-xcode-builder
2+
description: A GitHub Action to build and archive Unity exported xcode projects.
3+
branding:
4+
icon: command
5+
color: blue
6+
inputs:
7+
xcode-version:
8+
description: The version of Xcode to use for building the Xcode project. Defaults to the active version of Xcode on the runner.
9+
required: false
10+
project-path:
11+
description: The directory that contains the exported xcode project from Unity.
12+
required: true
13+
app-store-connect-key:
14+
description: The App Store Connect API AuthKey_*.p8 key encoded as base64 string.
15+
required: true
16+
app-store-connect-key-id:
17+
description: The App Store Connect API key id.
18+
required: true
19+
app-store-connect-issuer-id:
20+
description: The issuer ID of the App Store Connect API key.
21+
required: true
22+
certificate:
23+
description: Exported signing certificate.p12 encoded as base64 string. Overrides the automatic signing in Xcode.
24+
required: false
25+
certificate-password:
26+
description: The password for the exported certificate. Required if `certificate` is provided.
27+
required: false
28+
signing-identity:
29+
description: The signing identity to use for signing the Xcode project. Parsed from the `certificate` if not provided.
30+
required: false
31+
provisioning-profile:
32+
description: The provisioning profile to use as base64 string. Overrides the automatic signing in Xcode.
33+
required: false
34+
provisioning-profile-name:
35+
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`.
36+
required: false
37+
team-id:
38+
description: The team ID to use for signing the Xcode project. Defaults to parsing team ID from `.xcodeproj`.
39+
required: false
40+
bundle-id:
41+
description: The bundle ID of the Xcode project. Defaults to parsing bundle ID from `.xcodeproj`.
42+
required: false
43+
configuration:
44+
description: The configuration to use when building the xcode project. Defaults to `Release`.
45+
required: false
46+
default: 'Release'
47+
scheme:
48+
description: The scheme to use when building the xcode project.
49+
required: false
50+
destination:
51+
description: The destination to use when building the xcode project. Defaults to `generic/platform={platform}`.
52+
required: false
53+
platform:
54+
description: The platform to build for. Can be one of `iOS`, `macOS`, `visionOS`, `tvOS`. Defaults to parsing platform from `.xcodeproj`.
55+
required: false
56+
export-option:
57+
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`.
58+
required: false
59+
default: development
60+
export-option-plist:
61+
description: The path to custom export option plist file to use when exporting the Xcode project. Overrides `export-option`.
62+
required: false
63+
entitlements-plist:
64+
description: The path to custom entitlements plist file. Generates default hardened runtime entitlements if not provided.
65+
required: false
66+
notarize:
67+
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`.
68+
required: false
69+
outputs:
70+
executable:
71+
description: The path to the generated archive executable.
72+
output-directory:
73+
description: The path to the export output directory.
574
runs:
675
using: 'node20'
776
main: 'dist/index.js'
8-
#post: 'dist/index.js'
77+
post: 'dist/index.js'

0 commit comments

Comments
 (0)