Skip to content
This repository was archived by the owner on Aug 11, 2024. It is now read-only.

Commit 68f07d7

Browse files
- fix macOS hub install
1 parent 9861a4f commit 68f07d7

File tree

4 files changed

+51
-13
lines changed

4 files changed

+51
-13
lines changed

dist/unity-install.ps1

+24-5
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,35 @@ if ( -not (Test-Path -Path "$hubPath") ) {
109109
exit 1
110110
}
111111
} elseif ($IsMacOS) {
112-
Write-Host "::group::Installing Unity Hub on masOS..."
112+
Write-Host "::group::Installing Unity Hub on macOS..."
113113
$package = "UnityHubSetup.dmg"
114114
$downloadPath = "$outPath/$package"
115115
$wc.DownloadFile("$baseUrl/$package", $downloadPath)
116116

117+
if (!(Test-Path $downloadPath)) {
118+
Write-Error "Failed to download $package"
119+
exit 1
120+
}
121+
117122
$dmgVolume = (sudo hdiutil attach $downloadPath -nobrowse) | Select-String -Pattern '\/Volumes\/.*' -AllMatches | ForEach-Object { $_.Matches } | ForEach-Object { $_.Value } | select-object -first 1
118-
Write-Host $dmgVolume
119-
$dmgAppPath = (find "$DMGVolume" -name "*.app" -depth 1)
120-
Write-Host $dmgAppPath
121-
sudo cp -rf "`"$dmgAppPath`"" "/Applications"
123+
Write-Host "DMG Volume: $dmgVolume"
124+
Start-Sleep -Seconds 1
125+
126+
if ([string]::IsNullOrEmpty($dmgVolume)) {
127+
Write-Error "Failed to mount DMG volume"
128+
exit 1
129+
}
130+
131+
$dmgAppPath = (sudo find "$dmgVolume" -name "*.app" -print | head -n 1)
132+
Write-Host "DMG App Path: $dmgAppPath"
133+
Start-Sleep -Seconds 1
134+
135+
if (!(Test-Path $dmgAppPath)) {
136+
Write-Error "Unity Hub app not found at expected path: $dmgAppPath"
137+
exit 1
138+
}
139+
140+
sudo cp -rf $dmgAppPath "/Applications"
122141
hdiutil unmount $dmgVolume
123142
sudo mkdir -p "/Library/Application Support/Unity"
124143
sudo chmod 775 "/Library/Application Support/Unity"

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "unity-setup",
3-
"version": "7.4.2",
3+
"version": "7.4.3",
44
"description": "An atomic GitHub action to download and install the Unity Editor for runners.",
55
"main": "src/index.js",
66
"scripts": {

src/unity-install.ps1

+24-5
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,35 @@ if ( -not (Test-Path -Path "$hubPath") ) {
109109
exit 1
110110
}
111111
} elseif ($IsMacOS) {
112-
Write-Host "::group::Installing Unity Hub on masOS..."
112+
Write-Host "::group::Installing Unity Hub on macOS..."
113113
$package = "UnityHubSetup.dmg"
114114
$downloadPath = "$outPath/$package"
115115
$wc.DownloadFile("$baseUrl/$package", $downloadPath)
116116

117+
if (!(Test-Path $downloadPath)) {
118+
Write-Error "Failed to download $package"
119+
exit 1
120+
}
121+
117122
$dmgVolume = (sudo hdiutil attach $downloadPath -nobrowse) | Select-String -Pattern '\/Volumes\/.*' -AllMatches | ForEach-Object { $_.Matches } | ForEach-Object { $_.Value } | select-object -first 1
118-
Write-Host $dmgVolume
119-
$dmgAppPath = (find "$DMGVolume" -name "*.app" -depth 1)
120-
Write-Host $dmgAppPath
121-
sudo cp -rf "`"$dmgAppPath`"" "/Applications"
123+
Write-Host "DMG Volume: $dmgVolume"
124+
Start-Sleep -Seconds 1
125+
126+
if ([string]::IsNullOrEmpty($dmgVolume)) {
127+
Write-Error "Failed to mount DMG volume"
128+
exit 1
129+
}
130+
131+
$dmgAppPath = (sudo find "$dmgVolume" -name "*.app" -print | head -n 1)
132+
Write-Host "DMG App Path: $dmgAppPath"
133+
Start-Sleep -Seconds 1
134+
135+
if (!(Test-Path $dmgAppPath)) {
136+
Write-Error "Unity Hub app not found at expected path: $dmgAppPath"
137+
exit 1
138+
}
139+
140+
sudo cp -rf $dmgAppPath "/Applications"
122141
hdiutil unmount $dmgVolume
123142
sudo mkdir -p "/Library/Application Support/Unity"
124143
sudo chmod 775 "/Library/Application Support/Unity"

0 commit comments

Comments
 (0)