diff --git a/UnitySetup/UnitySetup.psd1 b/UnitySetup/UnitySetup.psd1 index 0041b96..24acfb2 100644 --- a/UnitySetup/UnitySetup.psd1 +++ b/UnitySetup/UnitySetup.psd1 @@ -55,7 +55,7 @@ # Modules that must be imported into the global environment prior to importing this module RequiredModules = @( @{ModuleName = "powershell-yaml"; ModuleVersion = "0.3"; Guid = "6a75a662-7f53-425a-9777-ee61284407da" }, - @{ModuleName = "Az.Accounts"; ModuleVersion = "1.8.0"; Guid = "17a2feff-488b-47f9-8729-e2cec094624c" } + @{ModuleName = "Az.Accounts"; ModuleVersion = "2.19.0"; Guid = "17a2feff-488b-47f9-8729-e2cec094624c" } ) # Assemblies that must be loaded prior to importing this module diff --git a/UnitySetup/UnitySetup.psm1 b/UnitySetup/UnitySetup.psm1 index 548e677..59bdc89 100644 --- a/UnitySetup/UnitySetup.psm1 +++ b/UnitySetup/UnitySetup.psm1 @@ -433,9 +433,9 @@ function Find-UnitySetupInstaller { $unitySetupRegEx = "^(.+)\/([a-z0-9]+)\/(.+)\/(.+)-(\d+)\.(\d+)\.(\d+)([fpba])(\d+).$installerExtension$" $knownBaseUrls = @( - "https://download.unity3d.com/download_unity", - "https://netstorage.unity3d.com/unity", - "https://beta.unity3d.com/download" + "https://download.unity.com/download_unity", + "https://netstorage.unity.com/unity", + "https://beta.unity.com/download" ) $installerTemplates = @{ @@ -502,36 +502,36 @@ function Find-UnitySetupInstaller { # Every release type has a different pattern for finding installers $searchPages = @() switch ($Version.Release) { - 'a' { $searchPages += "https://unity3d.com/alpha/$($Version.Major).$($Version.Minor)" } + 'a' { $searchPages += "https://unity.com/alpha/$($Version.Major).$($Version.Minor)" } 'b' { - $searchPages += "https://unity3d.com/unity/beta/unity$Version", - "https://unity3d.com/unity/beta/$($Version.Major).$($Version.Minor)", - "https://unity3d.com/unity/beta/$Version" + $searchPages += "https://unity.com/unity/beta/unity$Version", + "https://unity.com/unity/beta/$($Version.Major).$($Version.Minor)", + "https://unity.com/unity/beta/$Version" } 'f' { - $searchPages += "https://unity3d.com/get-unity/download/archive", - "https://unity3d.com/unity/whats-new/$($Version.Major).$($Version.Minor).$($Version.Revision)" + $searchPages += "https://unity.com/get-unity/download/archive", + "https://unity.com/releases/editor/whats-new/$($Version.Major).$($Version.Minor).$($Version.Revision)$($Version.Release)$($Version.Build)" # Just in case it's a release candidate search the beta as well. if ($Version.Revision -eq '0') { - $searchPages += "https://unity3d.com/unity/beta/unity$Version", - "https://unity3d.com/unity/beta/$($Version.Major).$($Version.Minor)", - "https://unity3d.com/unity/beta/$Version" + $searchPages += "https://unity.com/unity/beta/unity$Version", + "https://unity.com/unity/beta/$($Version.Major).$($Version.Minor)", + "https://unity.com/unity/beta/$Version" } } 'p' { - $patchPage = "https://unity3d.com/unity/qa/patch-releases?version=$($Version.Major).$($Version.Minor)" + $patchPage = "https://unity.com/unity/qa/patch-releases?version=$($Version.Major).$($Version.Minor)" $searchPages += $patchPage $webResult = Invoke-WebRequest $patchPage -UseBasicParsing $searchPages += $webResult.Links | Where-Object { $_.href -match "\/unity\/qa\/patch-releases\?version=$($Version.Major)\.$($Version.Minor)&page=(\d+)" -and $Matches[1] -gt 1 } | - ForEach-Object { "https://unity3d.com$($_.href)" } + ForEach-Object { "https://unity.com$($_.href)" } } } if($Hash -ne ""){ - $searchPages += "http://beta.unity3d.com/download/$Hash/download.html" + $searchPages += "http://beta.unity.com/download/$Hash/download.html" } foreach ($page in $searchPages) { @@ -2214,15 +2214,7 @@ function New-PAT { [guid]$AzureSubscription ) - $azAccountsVersion = Get-ModuleVersion -ModuleName "Az.Accounts" - if ($azAccountsVersion) { - if ($azAccountsVersion -lt [version]"1.8" -or $azAccountsVersion -gt [version]"3.9.9999") { - if ($azAccountsVersion -ge [version]"4.0") { - throw "Az.Accounts version 4.0 includes a breaking change and is not compatible." - } - } - } - + $expireDate = (Get-Date).AddDays($ExpireDays).ToString('yyyy-MM-ddTHH:mm:ss.fffZ') $createPAT = 'y' @@ -2254,8 +2246,11 @@ Would you like to continue? (Default: $($createPAT))" } Connect-AzAccount @connectArgs | Out-Null } - $AZTokenRequest = Get-AzAccessToken -ResourceType Arm - $headers = @{ Authorization = "Bearer $($AZTokenRequest.Token)" } + + $AZTokenRequest = Get-AzAccessToken -AsSecureString -ResourceType Arm + $AZToken = [System.Net.NetworkCredential]::new($null, $AZTokenRequest.Token).Password + + $headers = @{ Authorization = "Bearer $($AZToken)" } } else { $headers = @{ Authorization = "Bearer $env:SYSTEM_ACCESSTOKEN" } @@ -2354,7 +2349,7 @@ function Read-PATFromUser($OrgName) { } function Get-RegExForConfig($Org, $Project, $Feed, $PAT) { - $regexresult = "[`r`n]*\[npmAuth\.""https:\/\/pkgs.dev.azure.com\/$($Org)\/" + $regexresult = "[\n\r\s]*\[npmAuth\.""https:\/\/pkgs.dev.azure.com\/$($Org)\/" if (-not [string]::IsNullOrEmpty($Project)) { $regexresult += "$($Project)\/" } @@ -2823,8 +2818,19 @@ function Update-UnityPackageManagerConfig { Export-UPMConfig -UPMConfig $upmConfigs -tomlFilePaths $tomlFilePaths } - Write-Verbose "Summary" - Write-Output $upmConfigs + if ($upmConfigs) { + Write-Verbose "Summary" + $upmConfigs = $upmConfigs | ForEach-Object { + [PSCustomObject]@{ + ScopedURL = $_.ScopedURL + Succeeded = -not [string]::IsNullOrEmpty($_.Auth) + } + } | Format-Table -AutoSize | Out-String + + Write-Verbose $upmConfigs + } else { + Write-Verbose "No changes were made" + } } if ($VerifyOnly) { diff --git a/appveyor.yml b/appveyor.yml index 784bb61..e01e714 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,15 +6,13 @@ install: - ps: >- $ErrorActionPreference = 'Stop' - Install-PackageProvider -Name NuGet -Force - Remove-Module 'PowerShellGet' -Force -ErrorAction SilentlyContinue -Verbose Install-Module 'PowerShellGet' -Scope CurrentUser -Force -AllowClobber -Verbose Install-Module 'powershell-yaml' -Scope CurrentUser -Force -AllowClobber -Verbose - Install-Module 'Az.Accounts' -RequiredVersion 2.15.1 -Scope CurrentUser -Force -AllowClobber -Verbose + Install-Module 'Az.Accounts' -RequiredVersion 2.19.0 -Scope CurrentUser -Force -AllowClobber -Verbose build_script: - ps: .\build.ps1 -Revision "$env:APPVEYOR_BUILD_NUMBER" -Suffix "$env:APPVEYOR_REPO_BRANCH" deploy_script: @@ -37,4 +35,3 @@ for: branches: only: - develop - - alpha