diff --git a/.github/workflows/WAU-AutoCreatePreVersion.yml b/.github/workflows/WAU-AutoCreatePreVersion.yml index b13e351..953e187 100644 --- a/.github/workflows/WAU-AutoCreatePreVersion.yml +++ b/.github/workflows/WAU-AutoCreatePreVersion.yml @@ -64,15 +64,13 @@ jobs: id: WAU_version run: | echo "Next Release version: ${{ steps.versioning.outputs.version }}" - echo "PowerShell format version: ${{ steps.versioning.outputs.version }}" | tr '-' '.' - echo PSVersion=$(echo '${{ steps.versioning.outputs.version }}' | tr '-' '.') >> $GITHUB_OUTPUT - name: Overwrite Version.txt file uses: DamianReeves/write-file-action@v1.2 with: path: Winget-AutoUpdate/Version.txt write-mode: overwrite - contents: ${{ steps.WAU_version.outputs.PSVersion }} + contents: ${{ steps.versioning.outputs.version }} - name: Commit & Push uses: actions-js/push@v1.4 diff --git a/Winget-AutoUpdate-Install.ps1 b/Winget-AutoUpdate-Install.ps1 index fe37eca..d72ce5a 100644 --- a/Winget-AutoUpdate-Install.ps1 +++ b/Winget-AutoUpdate-Install.ps1 @@ -340,8 +340,6 @@ function Install-WingetAutoUpdate { New-ItemProperty $regPath -Name QuietUninstallString -Value "powershell.exe -noprofile -executionpolicy bypass -file `"$WingetUpdatePath\WAU-Uninstall.ps1`"" -Force | Out-Null New-ItemProperty $regPath -Name NoModify -Value 1 -Force | Out-Null New-ItemProperty $regPath -Name NoRepair -Value 1 -Force | Out-Null - New-ItemProperty $regPath -Name VersionMajor -Value ([version]$WAUVersion).Major -Force | Out-Null - New-ItemProperty $regPath -Name VersionMinor -Value ([version]$WAUVersion).Minor -Force | Out-Null New-ItemProperty $regPath -Name Publisher -Value "Romanitho" -Force | Out-Null New-ItemProperty $regPath -Name URLInfoAbout -Value "https://github.com/Romanitho/Winget-AutoUpdate" -Force | Out-Null New-ItemProperty $regPath -Name WAU_NotificationLevel -Value $NotificationLevel -Force | Out-Null diff --git a/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 b/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 index e952927..ffd98bb 100644 --- a/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 +++ b/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 @@ -157,13 +157,11 @@ function Invoke-PostUpdateActions { Write-ToLog "-> Error: The mods directory couldn't be verified as secured!" "red" } - #Convert about.xml if exists (previous WAU versions) to reg + #Convert about.xml if exists (old WAU versions) to reg $WAUAboutPath = "$WorkingDir\config\about.xml" if (test-path $WAUAboutPath) { [xml]$About = Get-Content $WAUAboutPath -Encoding UTF8 -ErrorAction SilentlyContinue New-ItemProperty $regPath -Name DisplayVersion -Value $About.app.version -Force - New-ItemProperty $regPath -Name VersionMajor -Value ([version]$About.app.version).Major -Force - New-ItemProperty $regPath -Name VersionMinor -Value ([version]$About.app.version).Minor -Force #Remove file once converted Remove-Item $WAUAboutPath -Force -Confirm:$false @@ -205,6 +203,17 @@ function Invoke-PostUpdateActions { } } + #Remove old registry key + $RegistryKeys = @( + "VersionMajor", + "VersionMinor" + ) + foreach ($RegistryKey in $RegistryKeys) { + if (Get-ItemProperty -Path $regPath -Name $RegistryKey -ErrorAction SilentlyContinue) { + Remove-ItemProperty -Path $regPath -Name $RegistryKey + } + } + #Reset WAU_UpdatePostActions Value $WAUConfig | New-ItemProperty -Name WAU_PostUpdateActions -Value 0 -Force