Skip to content

Commit

Permalink
unity-xcode-builder@v1.1.0 (#5)
Browse files Browse the repository at this point in the history
- added app validation
- added app upload to app store connect
  • Loading branch information
StephenHodgson authored Oct 17, 2024
1 parent 8f456e7 commit e84ed1a
Show file tree
Hide file tree
Showing 15 changed files with 24,872 additions and 5,031 deletions.
36 changes: 27 additions & 9 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,6 +55,15 @@ 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: RageAgainstThePixel/activate-unity-license@v1
Expand All @@ -58,7 +76,7 @@ jobs:
with:
log-name: 'create-test-project'
args: '-quit -nographics -batchmode -createProject "${{ github.workspace }}/UnityProject" -cloneFromTemplate "${{ env.TEMPLATE_PATH }}"'
- run: 'openupm add com.utilities.buildpipeline'
- run: openupm add com.utilities.buildpipeline
name: Add Build Pipeline Package
working-directory: ${{ github.workspace }}/UnityProject
- uses: RageAgainstThePixel/unity-action@v1
Expand All @@ -72,8 +90,7 @@ jobs:
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'

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:
Expand All @@ -82,9 +99,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
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# unity-xcode-builder

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://github.com/RageAgainstThePixel/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: RageAgainstThePixel/unity-xcode-builder@v1
Expand Down Expand Up @@ -61,7 +63,9 @@ This action requires several secrets that need to be setup in the repository or
| `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
8 changes: 7 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: unity-xcode-builder
description: A GitHub Action to build and archive Unity exported xcode projects.
description: A GitHub Action to build, archive, and upload Unity exported xcode projects.
branding:
icon: command
color: blue
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

0 comments on commit e84ed1a

Please sign in to comment.