Skip to content

Commit a2ca1a0

Browse files
refactor workflows
1 parent b968626 commit a2ca1a0

File tree

2 files changed

+38
-46
lines changed

2 files changed

+38
-46
lines changed

.github/workflows/build-options.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"VisionOS"
1616
],
1717
"xcode-version": [
18+
"16.2",
1819
"16.4"
1920
],
2021
"exclude": [

.github/workflows/build.yml

Lines changed: 37 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ jobs:
2323
contents: read
2424
env:
2525
VERSION: ''
26-
TEMPLATE_PATH: ''
2726
EXPORT_OPTION: ''
2827
BUILD_DIRECTORY: ''
29-
UNITY_PROJECT_PATH: ''
28+
UNITY_PROJECT_PATH: ${{ github.workspace }}/UnityProject
3029
steps:
3130
- uses: actions/checkout@v4
3231
- run: 'npm install -g openupm-cli'
@@ -35,63 +34,56 @@ jobs:
3534
version-file: 'None'
3635
build-targets: ${{ matrix.build-target }}
3736
unity-version: ${{ matrix.unity-version }}
38-
- name: Find Unity Template Path and Version
37+
- name: Set Build Args
38+
shell: bash
3939
run: |
40-
$rootPath = $env:UNITY_EDITOR_PATH -replace "Editor.*", ""
41-
Write-Host "ROOT_PATH=$rootPath"
42-
$templatePath = Get-ChildItem -Recurse -Filter "com.unity.template.3d*.tgz" -Path $rootPath | Select-Object -First 1 | Select-Object -ExpandProperty FullName
43-
Write-Host "TEMPLATE_PATH=$templatePath"
44-
echo "TEMPLATE_PATH=$templatePath" >> $env:GITHUB_ENV
45-
$projectPath = "${{ github.workspace }}/UnityProject"
46-
echo "UNITY_PROJECT_PATH=$projectPath" >> $env:GITHUB_ENV
47-
40+
set -e
4841
# Read version from package.json instead of git tags
49-
$packageJsonPath = "${{ github.workspace }}/package.json"
50-
$packageJson = Get-Content -Raw -Path $packageJsonPath | ConvertFrom-Json
51-
$version = $packageJson.version
52-
53-
if ($version -match '^\d+\.\d+\.\d+$') {
54-
Write-Host "Version from package.json: $version"
55-
} else {
56-
Write-Host "Version: $version is not a valid version string"
57-
exit 1
58-
}
59-
echo "VERSION=$version" >> $env:GITHUB_ENV
42+
package_json_path="${{ github.workspace }}/package.json"
43+
version=$(jq -r .version "$package_json_path")
44+
45+
if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
46+
echo "Version from package.json: $version"
47+
else
48+
echo "Version: $version is not a valid version string"
49+
exit 1
50+
fi
51+
echo "VERSION=$version" >> "$GITHUB_ENV"
6052
6153
# if the unity-version is 6000.1.x then set export option to app-store-connect otherwise set it to development
62-
if ('${{ matrix.unity-version }}' -eq '6000.1.x') {
63-
echo "EXPORT_OPTION=app-store-connect" >> $env:GITHUB_ENV
64-
} else {
65-
if ('${{ matrix.build-target }}' -eq 'StandaloneOSX') {
66-
if ('${{ matrix.unity-version }}' -eq '2022.x') {
67-
echo "EXPORT_OPTION=steam" >> $env:GITHUB_ENV
68-
} else {
69-
echo "EXPORT_OPTION=developer-id" >> $env:GITHUB_ENV
70-
}
71-
} else {
72-
echo "EXPORT_OPTION=development" >> $env:GITHUB_ENV
73-
}
74-
}
54+
if [[ "${{ matrix.unity-version }}" == "6000.1.x" ]]; then
55+
echo "EXPORT_OPTION=app-store-connect" >> "$GITHUB_ENV"
56+
else
57+
if [[ "${{ matrix.build-target }}" == "StandaloneOSX" ]]; then
58+
if [[ "${{ matrix.unity-version }}" == "2022.x" ]]; then
59+
echo "EXPORT_OPTION=steam" >> "$GITHUB_ENV"
60+
else
61+
echo "EXPORT_OPTION=developer-id" >> "$GITHUB_ENV"
62+
fi
63+
else
64+
echo "EXPORT_OPTION=development" >> "$GITHUB_ENV"
65+
fi
66+
fi
7567
7668
# set BUILD_DIRECTORY to a path in the root of the workspace named ./Builds/<build-target>/
77-
$buildDirectory = "${{ github.workspace }}/Builds/${{ matrix.build-target }}"
78-
echo "Creating build directory at $buildDirectory"
79-
New-Item -ItemType Directory -Path $buildDirectory -Force | Out-Null
80-
echo "BUILD_DIRECTORY=$buildDirectory" >> $env:GITHUB_ENV
81-
shell: pwsh
69+
build_directory="${{ github.workspace }}/Builds/${{ matrix.build-target }}"
70+
echo "Creating build directory at $build_directory"
71+
mkdir -p "$build_directory"
72+
echo "BUILD_DIRECTORY=$build_directory" >> "$GITHUB_ENV"
8273
- uses: buildalon/activate-unity-license@v1
8374
with:
8475
license: 'Personal'
8576
username: ${{ secrets.UNITY_USERNAME }}
8677
password: ${{ secrets.UNITY_PASSWORD }}
87-
- uses: buildalon/unity-action@v1
78+
- uses: buildalon/create-unity-project@v1
8879
name: Create Test Project
8980
with:
90-
log-name: 'create-test-project'
91-
args: '-quit -nographics -batchmode -createProject "${{ github.workspace }}/UnityProject" -cloneFromTemplate "${{ env.TEMPLATE_PATH }}"'
81+
project-name: UnityProject
82+
project-directory: ${{ env.UNITY_PROJECT_PATH }}
83+
template-name: com.unity.template.3d(-cross-platform)?
9284
- run: openupm add com.virtualmaker.buildalon
9385
name: Add Build Pipeline Package
94-
working-directory: ${{ github.workspace }}/UnityProject
86+
working-directory: ${{ env.UNITY_PROJECT_PATH }}
9587
- uses: buildalon/unity-action@v1
9688
name: '${{ matrix.build-target }}-Validate'
9789
with:
@@ -107,7 +99,7 @@ jobs:
10799
- name: Update Info.Plist with encryption compliance
108100
shell: bash
109101
run: |
110-
set -xe
102+
set -e
111103
BUILD_DIRECTORY="${{ env.BUILD_DIRECTORY }}"
112104
113105
if [ -z "$BUILD_DIRECTORY" ]; then
@@ -172,7 +164,6 @@ jobs:
172164
developer-id-installer-certificate: ${{ secrets.DEVELOPER_ID_INSTALLER_CERT }}
173165
developer-id-installer-certificate-password: ${{ secrets.SIGNING_CERT_PASSWORD }}
174166
- name: print outputs
175-
if: always()
176167
run: |
177168
set -e
178169

0 commit comments

Comments
 (0)