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