Skip to content

Update current version detection in do-we-need-to-upgrade.ps1 #31

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
12 changes: 10 additions & 2 deletions mf-automation/do-we-need-to-upgrade.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,16 @@ $rsp = Invoke-RestMethod -Uri $URI -Method Get -Headers @{ 'Authorization' = $HE
$INSTALLED_RELEASE = [System.Version]($rsp.applicationServer.systemInfo.Version -replace '^([\.\d]+).+','$1')

# Get the latest release from the PaperCut website (parse the XML Atom feed)
$CURRENT_RELEASE = [System.Version]((Invoke-RestMethod -uri http://www.papercut.com/products/mf/release-history.atom).id[0] `
-replace "^tag:papercut.com,[0-9]+-[0-9]+-[0-9]+:$PRODUCT\/releases\/v(\d+)-(\d+)-(\d+)",'$1.$2.$3')
$releases = Invoke-RestMethod -uri http://www.papercut.com/products/mf/release-history.atom
# Find the latest release for the Current major version, so updates to older versions are ignored.
$releases |ForEach-Object {
$version = [System.Version]$_.id.Split('/v')[-1].Replace('-','.')
if($version -gt $latest.version){
$latest = $_
$latest | Add-Member -MemberType NoteProperty -Name "version" -Value $version
}
}
$CURRENT_RELEASE = $latest.version

Write-Host "Latest PaperCut release is $CURRENT_RELEASE. Installed Release is $INSTALLED_RELEASE"

Expand Down