|
5 | 5 | pull_request:
|
6 | 6 | types: [opened, reopened, synchronize, ready_for_review]
|
7 | 7 | branches: ['*']
|
8 |
| - # Allows you to run this workflow manually from the Actions tab |
9 |
| - workflow_dispatch: |
| 8 | + workflow_dispatch: # Allows you to run this workflow manually from the Actions tab |
10 | 9 | concurrency:
|
11 | 10 | group: ${{ github.workflow }}-${{ github.ref }}
|
12 | 11 | cancel-in-progress: true
|
13 | 12 | jobs:
|
14 |
| - unity-build: |
| 13 | + setup: |
15 | 14 | if: github.event.pull_request.draft == false
|
16 |
| - name: '(${{ matrix.unity-version }}) ${{ matrix.build-target }}' |
| 15 | + runs-on: ubuntu-latest |
17 | 16 | permissions:
|
18 | 17 | contents: read
|
19 |
| - env: |
20 |
| - VERSION: '' |
21 |
| - TEMPLATE_PATH: '' |
22 |
| - EXPORT_OPTION: '' |
23 |
| - UNITY_PROJECT_PATH: '' |
24 |
| - runs-on: ${{ matrix.os }} |
25 |
| - strategy: |
26 |
| - fail-fast: false |
27 |
| - matrix: |
28 |
| - os: [macos-latest] |
29 |
| - unity-version: [2021.x, 2022.x, 6000.x] |
30 |
| - build-target: |
31 |
| - - iOS |
32 |
| - - StandaloneOSX |
33 |
| - - VisionOS |
34 |
| - exclude: |
35 |
| - - os: macos-latest |
36 |
| - unity-version: 2021.x |
37 |
| - build-target: VisionOS |
38 |
| - - os: macos-latest |
39 |
| - unity-version: 2022.x |
40 |
| - build-target: VisionOS |
41 | 18 | steps:
|
42 | 19 | - uses: actions/checkout@v4
|
43 |
| - - run: 'npm install -g openupm-cli' |
44 |
| - - uses: buildalon/unity-setup@v1 |
45 |
| - with: |
46 |
| - version-file: 'None' |
47 |
| - build-targets: ${{ matrix.build-target }} |
48 |
| - unity-version: ${{ matrix.unity-version }} |
49 |
| - - name: Find Unity Template Path and Version |
50 |
| - run: | |
51 |
| - $rootPath = $env:UNITY_EDITOR_PATH -replace "Editor.*", "" |
52 |
| - Write-Host "ROOT_PATH=$rootPath" |
53 |
| - $templatePath = Get-ChildItem -Recurse -Filter "com.unity.template.3d*.tgz" -Path $rootPath | Select-Object -First 1 | Select-Object -ExpandProperty FullName |
54 |
| - Write-Host "TEMPLATE_PATH=$templatePath" |
55 |
| - echo "TEMPLATE_PATH=$templatePath" >> $env:GITHUB_ENV |
56 |
| - $projectPath = "${{ github.workspace }}/UnityProject" |
57 |
| - echo "UNITY_PROJECT_PATH=$projectPath" >> $env:GITHUB_ENV |
58 |
| -
|
59 |
| - # Read version from package.json instead of git tags |
60 |
| - $packageJsonPath = "${{ github.workspace }}/package.json" |
61 |
| - $packageJson = Get-Content -Raw -Path $packageJsonPath | ConvertFrom-Json |
62 |
| - $version = $packageJson.version |
63 |
| -
|
64 |
| - if ($version -match '^\d+\.\d+\.\d+$') { |
65 |
| - Write-Host "Version from package.json: $version" |
66 |
| - } else { |
67 |
| - Write-Host "Version: $version is not a valid version string" |
68 |
| - exit 1 |
69 |
| - } |
70 |
| - echo "VERSION=$version" >> $env:GITHUB_ENV |
71 |
| -
|
72 |
| - # if the unity-version is 6000.x then set export option to app-store-connect otherwise set it to development |
73 |
| - if ('${{ matrix.unity-version }}' -eq '6000.x') { |
74 |
| - echo "EXPORT_OPTION=app-store-connect" >> $env:GITHUB_ENV |
75 |
| - } else { |
76 |
| - if ('${{ matrix.build-target }}' -eq 'StandaloneOSX') { |
77 |
| - if ('${{ matrix.unity-version }}' -eq '2022.x') { |
78 |
| - echo "EXPORT_OPTION=steam" >> $env:GITHUB_ENV |
79 |
| - } else { |
80 |
| - echo "EXPORT_OPTION=developer-id" >> $env:GITHUB_ENV |
81 |
| - } |
82 |
| - } else { |
83 |
| - echo "EXPORT_OPTION=development" >> $env:GITHUB_ENV |
84 |
| - } |
85 |
| - } |
86 |
| - shell: pwsh |
87 |
| - - uses: buildalon/activate-unity-license@v1 |
88 |
| - with: |
89 |
| - license: 'Personal' |
90 |
| - username: ${{ secrets.UNITY_USERNAME }} |
91 |
| - password: ${{ secrets.UNITY_PASSWORD }} |
92 |
| - - uses: buildalon/unity-action@v1 |
93 |
| - name: Create Test Project |
94 |
| - with: |
95 |
| - log-name: 'create-test-project' |
96 |
| - args: '-quit -nographics -batchmode -createProject "${{ github.workspace }}/UnityProject" -cloneFromTemplate "${{ env.TEMPLATE_PATH }}"' |
97 |
| - - run: openupm add com.virtualmaker.buildalon |
98 |
| - name: Add Build Pipeline Package |
99 |
| - working-directory: ${{ github.workspace }}/UnityProject |
100 |
| - - uses: buildalon/unity-action@v1 |
101 |
| - name: '${{ matrix.build-target }}-Validate' |
102 | 20 | with:
|
103 |
| - build-target: ${{ matrix.build-target }} |
104 |
| - log-name: '${{ matrix.build-target }}-Validate' |
105 |
| - args: '-quit -nographics -batchmode -executeMethod Buildalon.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject -importTMProEssentialsAsset' |
106 |
| - - uses: buildalon/unity-action@v1 |
107 |
| - name: '${{ matrix.build-target }}-Build' |
| 21 | + sparse-checkout: .github/ |
| 22 | + - uses: RageAgainstThePixel/job-builder@v1 |
| 23 | + id: setup-jobs |
108 | 24 | with:
|
109 |
| - build-target: ${{ matrix.build-target }} |
110 |
| - log-name: '${{ matrix.build-target }}-Build' |
111 |
| - 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 }}' |
112 |
| - - name: Update Info.Plist with encryption compliance |
113 |
| - shell: bash |
114 |
| - run: | |
115 |
| - set -xe |
116 |
| - # find the Info.plist file in the build directory |
117 |
| - # MacOSStandalone Info.plist path: /Users/runner/work/unity-xcode-builder/unity-xcode-builder/UnityProject/Builds/StandaloneOSX/com.test.buildalon.xcode/UnityProject/UnityProject/Info.plist |
118 |
| - # all others: /Users/runner/work/unity-xcode-builder/unity-xcode-builder/UnityProject/Builds/iOS/com.test.buildalon.xcode/Info.plist |
119 |
| - EXPORT_OPTION=${{ env.EXPORT_OPTION }} |
120 |
| - if [ "$EXPORT_OPTION" != "app-store-connect" ]; then |
121 |
| - exit 0 |
122 |
| - fi |
123 |
| - TARGET_PLATFORM=${{ matrix.build-target }} |
124 |
| - if [ "$TARGET_PLATFORM" == "StandaloneOSX" ]; then |
125 |
| - INFO_PLIST_PATH="${{ env.UNITY_PROJECT_PATH }}/Builds/${{ matrix.build-target }}/com.test.buildalon.xcode/UnityProject/UnityProject/Info.plist" |
126 |
| - else |
127 |
| - INFO_PLIST_PATH="${{ env.UNITY_PROJECT_PATH }}/Builds/${{ matrix.build-target }}/com.test.buildalon.xcode/Info.plist" |
128 |
| - fi |
129 |
| - # make sure plist buddy is installed |
130 |
| - if ! command -v /usr/libexec/PlistBuddy &> /dev/null |
131 |
| - then |
132 |
| - echo "PlistBuddy could not be found" |
133 |
| - exit 1 |
134 |
| - fi |
135 |
| - # set ITSAppUsesNonExemptEncryption to false in Info.plist using PlistBuddy |
136 |
| - /usr/libexec/PlistBuddy -c "Add :ITSAppUsesNonExemptEncryption bool false" "$INFO_PLIST_PATH" |
137 |
| - - uses: ./ # buildalon/unity-xcode-builder |
138 |
| - id: xcode-build |
139 |
| - with: |
140 |
| - project-path: ${{ env.UNITY_PROJECT_PATH }}/Builds/${{ matrix.build-target }}/**/*.xcodeproj |
141 |
| - app-store-connect-key: ${{ secrets.APP_STORE_CONNECT_KEY }} |
142 |
| - app-store-connect-key-id: ${{ secrets.APP_STORE_CONNECT_KEY_ID }} |
143 |
| - app-store-connect-issuer-id: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} |
144 |
| - team-id: ${{ secrets.APPLE_TEAM_ID }} |
145 |
| - export-option: ${{ env.EXPORT_OPTION }} |
146 |
| - notarize: ${{ matrix.unity-version != '6000.x' }} |
147 |
| - archive-type: pkg |
148 |
| - test-groups: Beta |
149 |
| - developer-id-application-certificate: ${{ secrets.DEVELOPER_ID_APPLICATION_CERT }} |
150 |
| - developer-id-application-certificate-password: ${{ secrets.SIGNING_CERT_PASSWORD }} |
151 |
| - developer-id-installer-certificate: ${{ secrets.DEVELOPER_ID_INSTALLER_CERT }} |
152 |
| - developer-id-installer-certificate-password: ${{ secrets.SIGNING_CERT_PASSWORD }} |
153 |
| - - name: print outputs |
154 |
| - if: always() |
155 |
| - run: | |
156 |
| - echo "Executable: ${{ steps.xcode-build.outputs.executable }}" |
157 |
| - echo "Output Directory: ${{ steps.xcode-build.outputs.output-directory }}" |
158 |
| - ls -R "${{ steps.xcode-build.outputs.output-directory }}" |
| 25 | + build-options: ./.github/workflows/build-options.json |
| 26 | + group-by: 'unity-version' |
| 27 | + outputs: |
| 28 | + jobs: ${{ steps.setup-jobs.outputs.jobs }} |
| 29 | + validate: |
| 30 | + if: ${{ needs.setup.outputs.jobs }} |
| 31 | + needs: setup |
| 32 | + name: build ${{ matrix.jobs.name }} |
| 33 | + permissions: |
| 34 | + contents: read |
| 35 | + strategy: |
| 36 | + matrix: ${{ fromJSON(needs.setup.outputs.jobs) }} |
| 37 | + fail-fast: false |
| 38 | + max-parallel: 1 |
| 39 | + secrets: inherit |
| 40 | + uses: ./.github/workflows/build.yml |
| 41 | + with: |
| 42 | + matrix: ${{ toJSON(matrix.jobs.matrix) }} |
0 commit comments