diff --git a/Tools/create_upg_chk_files.ps1 b/Tools/create_upg_chk_files.ps1 index dc90448f..8be9e0e7 100644 --- a/Tools/create_upg_chk_files.ps1 +++ b/Tools/create_upg_chk_files.ps1 @@ -6,12 +6,10 @@ param ( [string] [Parameter(Mandatory=$true)] - [ValidateSet("Stable","Beta","Development")] - $UpdateChannel + $ProjectName ) - function New-MsiUpdateFileContent { param ( [System.IO.FileInfo] @@ -64,7 +62,7 @@ function Resolve-UpdateCheckFileName { param ( [string] [Parameter(Mandatory=$true)] - [ValidateSet("Stable","Beta","Development")] + [ValidateSet("Stable","Preview","Nightly")] $UpdateChannel, [string] @@ -75,8 +73,8 @@ function Resolve-UpdateCheckFileName { $fileName = "" - if ($UpdateChannel -eq "Beta") { $fileName += "beta-" } - elseif ($UpdateChannel -eq "Development") { $fileName += "dev-" } + if ($UpdateChannel -eq "Preview") { $fileName += "preview-" } + elseif ($UpdateChannel -eq "Nightly") { $fileName += "nightly-" } $fileName += "update" @@ -87,23 +85,47 @@ function Resolve-UpdateCheckFileName { Write-Output $fileName } +Write-Output "Begin create_upg_chk_files.ps1" +# determine update channel +if ($env:APPVEYOR_PROJECT_NAME -match "(Nightly)") { + write-host "UpdateChannel = Nightly" + $UpdateChannel = "Nightly" +} elseif ($env:APPVEYOR_PROJECT_NAME -match "(Preview)") { + write-host "UpdateChannel = Nightly" + $UpdateChannel = "Preview" +} elseif ($env:APPVEYOR_PROJECT_NAME -match "(Stable)") { + write-host "UpdateChannel = Nightly" + $UpdateChannel = "Stable" +} else { + $UpdateChannel = "" +} +$buildFolder = Join-Path -Path $PSScriptRoot -ChildPath "..\mRemoteNG\bin\x64\Release" -Resolve -ErrorAction Ignore +if ($UpdateChannel -ne "" -and $buildFolder -ne "") { + $releaseFolder = Join-Path -Path $PSScriptRoot -ChildPath "..\Release" -Resolve + $msiFile = Get-ChildItem -Path "$buildFolder\*.msi" | Sort-Object LastWriteTime | Select-Object -last 1 + if (![string]::IsNullOrEmpty($msiFile)) { + $msiUpdateContents = New-MsiUpdateFileContent -MsiFile $msiFile -TagName $TagName + $msiUpdateFileName = Resolve-UpdateCheckFileName -UpdateChannel $UpdateChannel -Type Normal + Write-Output "`n`nMSI Update Check File Contents ($msiUpdateFileName)`n------------------------------" + Tee-Object -InputObject $msiUpdateContents -FilePath "$releaseFolder\$msiUpdateFileName" + write-host "msiUpdateFileName $releaseFolder\$msiUpdateFileName" + } -$releaseFolder = Join-Path -Path $PSScriptRoot -ChildPath "..\Release" -Resolve + # build zip update file + $releaseFolder = Join-Path -Path $PSScriptRoot -ChildPath "..\Release" -Resolve + $zipFile = Get-ChildItem -Path "$releaseFolder\*.zip" -Exclude "*-symbols-*.zip" | Sort-Object LastWriteTime | Select-Object -last 1 + if (![string]::IsNullOrEmpty($zipFile)) { + $zipUpdateContents = New-ZipUpdateFileContent -ZipFile $zipFile -TagName $TagName + $zipUpdateFileName = Resolve-UpdateCheckFileName -UpdateChannel $UpdateChannel -Type Portable + Write-Output "`n`nZip Update Check File Contents ($zipUpdateFileName)`n------------------------------" + Tee-Object -InputObject $zipUpdateContents -FilePath "$releaseFolder\$zipUpdateFileName" + write-host "zipUpdateFileName $releaseFolder\$zipUpdateFileName" + } +} else { + write-host "BuildFolder not found" +} -# build msi update file -$msiFile = Get-ChildItem -Path "$releaseFolder\*.msi" | sort LastWriteTime | select -last 1 -$msiUpdateContents = New-MsiUpdateFileContent -MsiFile $msiFile -TagName $TagName -$msiUpdateFileName = Resolve-UpdateCheckFileName -UpdateChannel $UpdateChannel -Type Normal -Write-Output "`n`nMSI Update Check File Contents ($msiUpdateFileName)`n------------------------------" -Tee-Object -InputObject $msiUpdateContents -FilePath "$releaseFolder\$msiUpdateFileName" - - -# build zip update file -$zipFile = Get-ChildItem -Path "$releaseFolder\*.zip" | sort LastWriteTime | select -last 1 -$zipUpdateContents = New-ZipUpdateFileContent -ZipFile $zipFile -TagName $TagName -$zipUpdateFileName = Resolve-UpdateCheckFileName -UpdateChannel $UpdateChannel -Type Portable -Write-Output "`n`nZip Update Check File Contents ($zipUpdateFileName)`n------------------------------" -Tee-Object -InputObject $zipUpdateContents -FilePath "$releaseFolder\$zipUpdateFileName" \ No newline at end of file +Write-Output "End create_upg_chk_files.ps1" diff --git a/Tools/postbuild_installer.ps1 b/Tools/postbuild_installer.ps1 index 707fccdb..fc01cdd9 100644 --- a/Tools/postbuild_installer.ps1 +++ b/Tools/postbuild_installer.ps1 @@ -41,3 +41,5 @@ Format-Table -AutoSize -Wrap -InputObject @{ & "$PSScriptRoot\sign_binaries.ps1" -TargetDir $TargetDir -CertificatePath $CertificatePath -CertificatePassword $CertificatePassword -ConfigurationName $ConfigurationName -Exclude $ExcludeFromSigning -SolutionDir $SolutionDir & "$PSScriptRoot\verify_binary_signatures.ps1" -TargetDir $TargetDir -ConfigurationName $ConfigurationName -CertificatePath $CertificatePath -SolutionDir $SolutionDir & "$PSScriptRoot\rename_and_copy_installer.ps1" -SolutionDir $SolutionDir -BuildConfiguration $ConfigurationName.Trim() +& "$PSScriptRoot\create_upg_chk_files.ps1" -TagName $env:APPVEYOR_BUILD_VERSION -ProjectName $env:APPVEYOR_PROJECT_NAME + diff --git a/Tools/postbuild_mremoteng.ps1 b/Tools/postbuild_mremoteng.ps1 index fe7b7382..697b909a 100644 --- a/Tools/postbuild_mremoteng.ps1 +++ b/Tools/postbuild_mremoteng.ps1 @@ -59,3 +59,5 @@ Format-Table -AutoSize -Wrap -InputObject @{ & "$PSScriptRoot\sign_binaries.ps1" -TargetDir $TargetDir -CertificatePath $CertificatePath -CertificatePassword $CertificatePassword -ConfigurationName $ConfigurationName -Exclude $ExcludeFromSigning -SolutionDir $SolutionDir & "$PSScriptRoot\verify_binary_signatures.ps1" -TargetDir $TargetDir -ConfigurationName $ConfigurationName -CertificatePath $CertificatePath -SolutionDir $SolutionDir & "$PSScriptRoot\zip_files.ps1" -SolutionDir $SolutionDir -TargetDir $TargetDir -ConfigurationName $ConfigurationName +& "$PSScriptRoot\create_upg_chk_files.ps1" -TagName $env:APPVEYOR_BUILD_VERSION -ProjectName $env:APPVEYOR_PROJECT_NAME + diff --git a/Tools/rename_and_copy_installer.ps1 b/Tools/rename_and_copy_installer.ps1 index 0667cee9..5218b21c 100644 --- a/Tools/rename_and_copy_installer.ps1 +++ b/Tools/rename_and_copy_installer.ps1 @@ -7,9 +7,10 @@ $targetVersionedFile = "$SolutionDir\mRemoteNG\bin\x64\$BuildConfiguration\mRemoteNG.exe" -$version = &"$SolutionDir\Tools\exes\sigcheck.exe" /accepteula -q -n $targetVersionedFile +#$fileversion = &"$SolutionDir\Tools\exes\sigcheck.exe" /accepteula -q -n $targetVersionedFile +$prodversion = ((Get-Item -Path $targetVersionedFile).VersionInfo | Select-Object -Property ProductVersion)."ProductVersion" $src = $SolutionDir + "mRemoteNGInstaller\Installer\bin\$BuildConfiguration\en-US\mRemoteNG-Installer.msi" -$dst = $SolutionDir + "mRemoteNG\bin\x64\$BuildConfiguration\mRemoteNG-Installer-" + $version + ".msi" +$dst = $SolutionDir + "mRemoteNG\bin\x64\$BuildConfiguration\mRemoteNG-Installer-" + $prodversion + ".msi" # Copy file Copy-Item $src -Destination $dst -Force diff --git a/Tools/zip_files.ps1 b/Tools/zip_files.ps1 index b8a991f1..f5b2fcf3 100644 --- a/Tools/zip_files.ps1 +++ b/Tools/zip_files.ps1 @@ -18,7 +18,7 @@ Write-Output "===== Beginning $($PSCmdlet.MyInvocation.MyCommand) =====" $ConfigurationName = $ConfigurationName.Trim() Write-Output "Config Name (trimmed): '$($ConfigurationName)'" $exe = Join-Path -Path $TargetDir -ChildPath $TargetFileName -$Version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($exe).FileVersion +$version = ((Get-Item -Path $exe).VersionInfo | Select-Object -Property ProductVersion)."ProductVersion" Write-Output "Version is $($version)" # Fix for AppVeyor