From 306c9bdc4cb1161100759f3572c320dbab9bf64f Mon Sep 17 00:00:00 2001 From: ziti-ci Date: Sun, 1 Nov 2020 15:39:20 -0500 Subject: [PATCH] update the way the installer is generated to use /setversion to allow in-place upgrading --- Installer/ZitiDesktopEdge.aip | 16 +++++++-------- Installer/build.ps1 | 37 ++--------------------------------- update-versions.ps1 | 37 ++++++++++++----------------------- 3 files changed, 23 insertions(+), 67 deletions(-) diff --git a/Installer/ZitiDesktopEdge.aip b/Installer/ZitiDesktopEdge.aip index 5d624a2d..e87b60bf 100644 --- a/Installer/ZitiDesktopEdge.aip +++ b/Installer/ZitiDesktopEdge.aip @@ -1,5 +1,5 @@ - - + + @@ -22,10 +22,10 @@ - + - + @@ -265,12 +265,12 @@ - - + + - - + + diff --git a/Installer/build.ps1 b/Installer/build.ps1 index 4504e635..c323c666 100644 --- a/Installer/build.ps1 +++ b/Installer/build.ps1 @@ -4,48 +4,15 @@ rm .\build -r -fo -ErrorAction Ignore $invocation = (Get-Variable MyInvocation).Value $scriptPath = Split-Path $invocation.MyCommand.Path -${scriptPath} - -$x=[xml] @" -$((Invoke-WebRequest https://netfoundry.jfrog.io/artifactory/ziti-maven-snapshot/ziti-tunnel-win/amd64/windows/ziti-tunnel-win/maven-metadata.xml).Content) -"@ echo "the branch is $env:GIT_BRANCH" -$branch = git rev-parse --abbrev-ref HEAD - -if ("$branch" -ne 'master') { - #if the git command to get the branch fails - this is 'not master' use the 'latest' - else fetch the 'release' - $serviceVersion = $x.metadata.versioning.latest -} -else { - $serviceVersion = $x.metadata.versioning.release -} -echo "service version is: $serviceVersion" -$installerVersion=(Get-Content -Path .\version) - -$zipUrl = "https://netfoundry.jfrog.io/artifactory/ziti-maven-snapshot/ziti-tunnel-win/amd64/windows/ziti-tunnel-win/${serviceVersion}/ziti-tunnel-win-${serviceVersion}.zip" - -echo "Downloading zip file " -echo " from: $zipUrl" - -tree ${scriptPath}.. - -$ProgressPreference = 'SilentlyContinue' -$timeTaken = Measure-Command -Expression { - Invoke-WebRequest $zipUrl -OutFile ziti-tunnel-service.zip -} - $zipLocal = "ziti-tunnel-service.zip" $zipLocal = "${scriptPath}/../service/ziti-tunnel-win.zip" -$milliseconds = $timeTaken.TotalMilliseconds -echo " time to download: $milliseconds" echo "" echo "unzipping $zipLocal to ${scriptPath}\build\service\" -$ProgressPreference = 'Continue' - Expand-Archive -Verbose -Force -LiteralPath $zipLocal "${scriptPath}\build\service\" Push-Location ${scriptPath}\.. @@ -53,7 +20,6 @@ echo "Updating the version for UI and Installer" .\update-versions.ps1 echo "Building the UI" -#msbuild DesktopEdge\ZitiDesktopEdge.csproj /property:Configuration=Release msbuild ZitiDesktopEdge.sln /property:Configuration=Release echo "Building the Wintun installer" @@ -63,8 +29,9 @@ Pop-Location $ADVINST = "C:\Program Files (x86)\Caphyon\Advanced Installer 17.6\bin\x86\AdvancedInstaller.com" $ADVPROJECT = "${scriptPath}\ZitiDesktopEdge.aip" - +$installerVersion=(Get-Content -Path ${scriptPath}\..\version) $action = '/SetVersion' + echo "issuing $ADVINST /edit $ADVPROJECT $action $installerVersion (service version: $serviceVersion) - see https://www.advancedinstaller.com/user-guide/set-version.html" & $ADVINST /edit $ADVPROJECT $action $installerVersion diff --git a/update-versions.ps1 b/update-versions.ps1 index 960c205a..6973e824 100644 --- a/update-versions.ps1 +++ b/update-versions.ps1 @@ -1,25 +1,14 @@ -echo "==================================== update-versions.ps1 begins ====================================" -echo "Obtaining version information from .\version" -$v=(Get-Content -Path .\version) -echo " version: $v" -echo "" - -rm temp.cs -ErrorAction Ignore -rm temp.aip -ErrorAction Ignore - -$assemblyInfo="./DesktopEdge/Properties/AssemblyInfo.cs" -$assemblyInfoReplaced="${assemblyInfo}.replaced" -$installer="./Installer/ZitiDesktopEdge.aip" -$installerReplaced="${installer}.replaced" - -echo "Replacing version in $assemblyInfo into $assemblyInfoReplaced" -(Get-Content -Encoding UTF8 -path $assemblyInfo -Raw) -replace 'Version\("[0-9]*.[0-9]*.[0-9]*.0', "Version(""${v}.0" | Set-Content -Encoding UTF8 -Path "$assemblyInfoReplaced" -NoNewline -rm $assemblyInfo -mv $assemblyInfoReplaced $assemblyInfo - -echo "Replacing version in $installer into $installerReplaced" -(Get-Content -Encoding UTF8 -path $installer -Raw) -replace '"ProductVersion" Value="[0-9]*\.[0-9]*\.[0-9]*"', """ProductVersion"" Value=""${v}""" | Set-Content -Path "${installer}.replaced" -Encoding UTF8 -NoNewline -rm $installer -mv $installerReplaced $installer - +echo "==================================== update-versions.ps1 begins ====================================" +echo "Obtaining version information from .\version" +$v=(Get-Content -Path .\version) +echo " version: $v" +echo "" + +$assemblyInfo="./DesktopEdge/Properties/AssemblyInfo.cs" +$assemblyInfoReplaced="${assemblyInfo}.replaced" +echo "Replacing version in $assemblyInfo into $assemblyInfoReplaced" +(Get-Content -Encoding UTF8 -path $assemblyInfo -Raw) -replace 'Version\("[0-9]*.[0-9]*.[0-9]*.0', "Version(""${v}.0" | Set-Content -Encoding UTF8 -Path "$assemblyInfoReplaced" -NoNewline +rm $assemblyInfo +mv $assemblyInfoReplaced $assemblyInfo + echo "==================================== update-versions.ps1 complete ====================================" \ No newline at end of file