Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #709

Closed
wants to merge 19 commits into from
Closed

test #709

Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Set Repo as Variable
  • Loading branch information
Romanitho authored Sep 17, 2024
commit 015ac3731b71ae7d04ba7a7c836497b662a08a2b
3 changes: 3 additions & 0 deletions Sources/Winget-AutoUpdate/Winget-Upgrade.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ $null = cmd /c ''
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$Script:ProgressPreference = 'SilentlyContinue'

#Set GitHub Repo
$Script:GitHub_Repo = "Winget-AutoUpdate"

#Log initialization
$LogFile = "$WorkingDir\logs\updates.log"

Expand Down
12 changes: 6 additions & 6 deletions Sources/Winget-AutoUpdate/functions/Get-WAUAvailableVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ function Get-WAUAvailableVersion {

try {
#Get latest pre-release info
$WAUurl = 'https://api.github.com/repos/Romanitho/Winget-AutoUpdate/releases'
$WAUurl = "https://api.github.com/repos/Romanitho/$GitHub_Repo/releases"
$WAUAvailableVersion = ((Invoke-WebRequest $WAUurl -UseBasicParsing | ConvertFrom-Json)[0].tag_name).Replace("v", "")
}
catch {
$url = "https://github.com/Romanitho/Winget-AutoUpdate/releases"
$link = ((Invoke-WebRequest $url -UseBasicParsing).Links.href -match "/Winget-AutoUpdate/releases/tag/v*")[0]
$url = "https://github.com/Romanitho/$GitHub_Repo/releases"
$link = ((Invoke-WebRequest $url -UseBasicParsing).Links.href -match "/$GitHub_Repo/releases/tag/v*")[0]
$WAUAvailableVersion = $link.Trim().Split("v")[-1]
}

Expand All @@ -24,12 +24,12 @@ function Get-WAUAvailableVersion {

try {
#Get latest stable info
$WAUurl = 'https://api.github.com/repos/Romanitho/Winget-AutoUpdate/releases/latest'
$WAUurl = "https://api.github.com/repos/Romanitho/$GitHub_Repo/releases/latest"
$WAUAvailableVersion = ((Invoke-WebRequest $WAUurl -UseBasicParsing | ConvertFrom-Json)[0].tag_name).Replace("v", "")
}
catch {
$url = "https://github.com/Romanitho/Winget-AutoUpdate/releases/latest"
$link = ((Invoke-WebRequest $url -UseBasicParsing).Links.href -match "/Winget-AutoUpdate/releases/tag/v*")[0]
$url = "https://github.com/Romanitho/$GitHub_Repo/releases/latest"
$link = ((Invoke-WebRequest $url -UseBasicParsing).Links.href -match "/$GitHub_Repo/releases/tag/v*")[0]
$WAUAvailableVersion = $link.Trim().Split("v")[-1]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function Invoke-PostUpdateActions {

#Add 1 to counter file
try {
Invoke-RestMethod -Uri "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$($WAUConfig.DisplayVersion)/WAU_InstallCounter" | Out-Null
Invoke-RestMethod -Uri "https://github.com/Romanitho/$GitHub_Repo/releases/download/v$($WAUConfig.DisplayVersion)/WAU_InstallCounter" | Out-Null
}
catch {
Write-ToLog "-> Not able to report installation." "Yellow"
Expand Down
6 changes: 3 additions & 3 deletions Sources/Winget-AutoUpdate/functions/Update-WAU.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

function Update-WAU {

$OnClickAction = "https://github.com/Romanitho/Winget-AutoUpdate/releases"
$OnClickAction = "https://github.com/Romanitho/$GitHub_Repo/releases"
$Button1Text = $NotifLocale.local.outputs.output[10].message

#Send available update notification
Expand All @@ -21,7 +21,7 @@ function Update-WAU {

#Download the zip
Write-ToLog "Downloading the GitHub Repository Zip version $WAUAvailableVersion" "Cyan"
Invoke-RestMethod -Uri "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$($WAUAvailableVersion)/WAU.zip" -OutFile $ZipFile
Invoke-RestMethod -Uri "https://github.com/Romanitho/$GitHub_Repo/releases/download/v$($WAUAvailableVersion)/WAU.zip" -OutFile $ZipFile

#Extract Zip File
Write-ToLog "Unzipping the WAU Update package" "Cyan"
Expand Down Expand Up @@ -74,7 +74,7 @@ function Update-WAU {
#Download the msi
Write-ToLog "Downloading the GitHub Repository MSI version $WAUAvailableVersion" "Cyan"
$MsiFile = "$env:temp\WAU.msi"
Invoke-RestMethod -Uri "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$($WAUAvailableVersion)/WAU.msi" -OutFile $MsiFile
Invoke-RestMethod -Uri "https://github.com/Romanitho/$GitHub_Repo/releases/download/v$($WAUAvailableVersion)/WAU.msi" -OutFile $MsiFile

#Migrate registry to save current WAU settings
Write-ToLog "Saving current config before updating with MSI"
Expand Down