Skip to content

Commit

Permalink
Warn when release notes URL is identical to last release's
Browse files Browse the repository at this point in the history
  • Loading branch information
brogers5 committed Jul 12, 2023
1 parent 0804884 commit 4e7afb7
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,26 @@ $userAgent = "Update checker of Chocolatey Community Package 'xsplit-vcam'"

function global:au_BeforeUpdate ($Package) {
if ([string]::IsNullOrWhiteSpace($Latest.ReleaseNotes)) {
Write-Warning 'release_notes_url is not available - falling back on redirect from canonical URL'
Write-Warning 'release_notes_url is not available'
Write-Warning 'SplitMediaLabs may not have published release notes yet - consider delaying package release!'
Write-Warning 'For now, falling back on redirect from canonical URL'

$canonicalUri = 'https://xspl.it/vcam/relnotes'
$response = Invoke-WebRequest -Uri $canonicalUri -UserAgent $userAgent -MaximumRedirection 0 -SkipHttpErrorCheck -UseBasicParsing -ErrorAction SilentlyContinue
$redirectedUri = $response.Headers['Location']

$Latest.ReleaseNotes = $redirectedUri
}

$packageReleaseNotes = $Package.NuspecXml.package.metadata.releaseNotes

#SplitMediaLabs sometimes reuses URLs or doesn't bother to publish new release notes.
#For package release note purposes, note when this happens.
if ($packageReleaseNotes -eq $Latest.ReleaseNotes) {
Write-Warning 'releaseNotes URL is identical'
Write-Warning 'URL may have been reused, or no URL may be available'
}

#Archive this version for future development, since the vendor does not guarantee perpetual availability
$filePath = ".\XSplit_VCam_$($Latest.Version).msi"
Invoke-WebRequest -Uri $Latest.Url64 -OutFile $filePath
Expand Down

0 comments on commit 4e7afb7

Please # to comment.