File tree Expand file tree Collapse file tree 2 files changed +51
-0
lines changed
Tasks/InterceptSuite.ProxyBridge Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ Type : PackageTask
2+ WinGetIdentifier : InterceptSuite.ProxyBridge
3+ Skip : false
Original file line number Diff line number Diff line change 1+ $Object1 = Invoke-GitHubApi - Uri ' https://api.github.com/repos/InterceptSuite/ProxyBridge/releases/latest'
2+
3+ # Installer
4+ $this.CurrentState.Installer += [ordered ]@ {
5+ InstallerUrl = $Object1.assets.Where ({ $_.name.EndsWith (' .exe' ) -and $_.name -match ' Setup' }, ' First' )[0 ].browser_download_url | ConvertTo-UnescapedUri
6+ }
7+
8+ # Version
9+ $this.CurrentState.Version = [regex ]::Matches($this.CurrentState.Installer [0 ].InstallerUrl, ' (\d+(?:\.\d+)+)' )[-1 ].Groups[1 ].Value
10+
11+ switch - Regex ($this.Check ()) {
12+ ' New|Changed|Updated' {
13+ try {
14+ # ReleaseTime
15+ $this.CurrentState.ReleaseTime = $Object1.published_at.ToUniversalTime ()
16+
17+ if (-not [string ]::IsNullOrWhiteSpace($Object1.body )) {
18+ # ReleaseNotes (en-US)
19+ $this.CurrentState.Locale += [ordered ]@ {
20+ Locale = ' en-US'
21+ Key = ' ReleaseNotes'
22+ Value = $Object1.body | Convert-MarkdownToHtml - Extensions ' advanced' , ' emojis' , ' hardlinebreak' | Get-TextContent | Format-Text
23+ }
24+ } else {
25+ $this.Log (" No ReleaseNotes (en-US) for version $ ( $this.CurrentState.Version ) " , ' Warning' )
26+ }
27+
28+ # ReleaseNotesUrl (en-US)
29+ $this.CurrentState.Locale += [ordered ]@ {
30+ Locale = ' en-US'
31+ Key = ' ReleaseNotesUrl'
32+ Value = $Object1.html_url
33+ }
34+ } catch {
35+ $_ | Out-Host
36+ $this.Log ($_ , ' Warning' )
37+ }
38+
39+ $this.Print ()
40+ $this.Write ()
41+ }
42+ ' Changed|Updated' {
43+ $this.Message ()
44+ }
45+ ' Updated' {
46+ $this.Submit ()
47+ }
48+ }
You can’t perform that action at this time.
0 commit comments