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

Commit

Permalink
Browse files Browse the repository at this point in the history
- fix macOS hub install
  • Loading branch information
StephenHodgson authored Feb 15, 2024
1 parent 9861a4f commit 68f07d7
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 13 deletions.
29 changes: 24 additions & 5 deletions dist/unity-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,35 @@ if ( -not (Test-Path -Path "$hubPath") ) {
exit 1
}
} elseif ($IsMacOS) {
Write-Host "::group::Installing Unity Hub on masOS..."
Write-Host "::group::Installing Unity Hub on macOS..."
$package = "UnityHubSetup.dmg"
$downloadPath = "$outPath/$package"
$wc.DownloadFile("$baseUrl/$package", $downloadPath)

if (!(Test-Path $downloadPath)) {
Write-Error "Failed to download $package"
exit 1
}

$dmgVolume = (sudo hdiutil attach $downloadPath -nobrowse) | Select-String -Pattern '\/Volumes\/.*' -AllMatches | ForEach-Object { $_.Matches } | ForEach-Object { $_.Value } | select-object -first 1
Write-Host $dmgVolume
$dmgAppPath = (find "$DMGVolume" -name "*.app" -depth 1)
Write-Host $dmgAppPath
sudo cp -rf "`"$dmgAppPath`"" "/Applications"
Write-Host "DMG Volume: $dmgVolume"
Start-Sleep -Seconds 1

if ([string]::IsNullOrEmpty($dmgVolume)) {
Write-Error "Failed to mount DMG volume"
exit 1
}

$dmgAppPath = (sudo find "$dmgVolume" -name "*.app" -print | head -n 1)
Write-Host "DMG App Path: $dmgAppPath"
Start-Sleep -Seconds 1

if (!(Test-Path $dmgAppPath)) {
Write-Error "Unity Hub app not found at expected path: $dmgAppPath"
exit 1
}

sudo cp -rf $dmgAppPath "/Applications"
hdiutil unmount $dmgVolume
sudo mkdir -p "/Library/Application Support/Unity"
sudo chmod 775 "/Library/Application Support/Unity"
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "unity-setup",
"version": "7.4.2",
"version": "7.4.3",
"description": "An atomic GitHub action to download and install the Unity Editor for runners.",
"main": "src/index.js",
"scripts": {
Expand Down
29 changes: 24 additions & 5 deletions src/unity-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,35 @@ if ( -not (Test-Path -Path "$hubPath") ) {
exit 1
}
} elseif ($IsMacOS) {
Write-Host "::group::Installing Unity Hub on masOS..."
Write-Host "::group::Installing Unity Hub on macOS..."
$package = "UnityHubSetup.dmg"
$downloadPath = "$outPath/$package"
$wc.DownloadFile("$baseUrl/$package", $downloadPath)

if (!(Test-Path $downloadPath)) {
Write-Error "Failed to download $package"
exit 1
}

$dmgVolume = (sudo hdiutil attach $downloadPath -nobrowse) | Select-String -Pattern '\/Volumes\/.*' -AllMatches | ForEach-Object { $_.Matches } | ForEach-Object { $_.Value } | select-object -first 1
Write-Host $dmgVolume
$dmgAppPath = (find "$DMGVolume" -name "*.app" -depth 1)
Write-Host $dmgAppPath
sudo cp -rf "`"$dmgAppPath`"" "/Applications"
Write-Host "DMG Volume: $dmgVolume"
Start-Sleep -Seconds 1

if ([string]::IsNullOrEmpty($dmgVolume)) {
Write-Error "Failed to mount DMG volume"
exit 1
}

$dmgAppPath = (sudo find "$dmgVolume" -name "*.app" -print | head -n 1)
Write-Host "DMG App Path: $dmgAppPath"
Start-Sleep -Seconds 1

if (!(Test-Path $dmgAppPath)) {
Write-Error "Unity Hub app not found at expected path: $dmgAppPath"
exit 1
}

sudo cp -rf $dmgAppPath "/Applications"
hdiutil unmount $dmgVolume
sudo mkdir -p "/Library/Application Support/Unity"
sudo chmod 775 "/Library/Application Support/Unity"
Expand Down

0 comments on commit 68f07d7

Please sign in to comment.