From 2441a3fe4de68be9b5b68514e4e0189bc9b85bf1 Mon Sep 17 00:00:00 2001 From: neveler <55753029+neveler@users.noreply.github.com> Date: Sun, 10 May 2026 20:18:15 +0800 Subject: [PATCH 1/2] add PCLCommunity.PCL2-CE --- Tasks/PCLCommunity.PCL2-CE/Config.yaml | 3 ++ Tasks/PCLCommunity.PCL2-CE/Script.ps1 | 53 ++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 Tasks/PCLCommunity.PCL2-CE/Config.yaml create mode 100644 Tasks/PCLCommunity.PCL2-CE/Script.ps1 diff --git a/Tasks/PCLCommunity.PCL2-CE/Config.yaml b/Tasks/PCLCommunity.PCL2-CE/Config.yaml new file mode 100644 index 0000000000..0deb592c90 --- /dev/null +++ b/Tasks/PCLCommunity.PCL2-CE/Config.yaml @@ -0,0 +1,3 @@ +Type: PackageTask +WinGetIdentifier: PCLCommunity.PCL2-CE +Skip: false diff --git a/Tasks/PCLCommunity.PCL2-CE/Script.ps1 b/Tasks/PCLCommunity.PCL2-CE/Script.ps1 new file mode 100644 index 0000000000..502f6dc6ea --- /dev/null +++ b/Tasks/PCLCommunity.PCL2-CE/Script.ps1 @@ -0,0 +1,53 @@ +$Object1 = Invoke-GitHubApi -Uri 'https://api.github.com/repos/PCL-Community/PCL-CE/releases/latest' + +# Version +$this.CurrentState.Version = $Object1.tag_name -replace '^v' + +# Installer +$this.CurrentState.Installer += [ordered]@{ + Architecture = 'x64' + InstallerUrl = $Object1.assets.Where({ $_.name.EndsWith('.exe') -and $_.name.Contains('x64') }, 'First')[0].browser_download_url | ConvertTo-UnescapedUri +} +$this.CurrentState.Installer += [ordered]@{ + Architecture = 'arm64' + InstallerUrl = $Object1.assets.Where({ $_.name.EndsWith('.exe') -and $_.name.Contains('ARM64') }, 'First')[0].browser_download_url | ConvertTo-UnescapedUri +} + +switch -Regex ($this.Check()) { + 'New|Changed|Updated' { + try { + # ReleaseTime + $this.CurrentState.ReleaseTime = $Object1.published_at.ToUniversalTime() + + if (-not [string]::IsNullOrWhiteSpace($Object1.body)) { + # ReleaseNotes (zh-CN) + $this.CurrentState.Locale += [ordered]@{ + Locale = 'zh-CN' + Key = 'ReleaseNotes' + Value = $Object1.body | Convert-MarkdownToHtml -Extensions 'advanced', 'emojis', 'hardlinebreak' | Get-TextContent | Format-Text + } + } else { + $this.Log("No ReleaseNotes (zh-CN) for version $($this.CurrentState.Version)", 'Warning') + } + + # ReleaseNotesUrl (zh-CN) + $this.CurrentState.Locale += [ordered]@{ + Locale = 'zh-CN' + Key = 'ReleaseNotesUrl' + Value = $Object1.html_url + } + } catch { + $_ | Out-Host + $this.Log($_, 'Warning') + } + + $this.Print() + $this.Write() + } + 'Changed|Updated' { + $this.Message() + } + 'Updated' { + $this.Submit() + } +} From f5616bd3c448082bfc0d74616383b435e278f1be Mon Sep 17 00:00:00 2001 From: neveler <55753029+neveler@users.noreply.github.com> Date: Sun, 10 May 2026 20:23:32 +0800 Subject: [PATCH 2/2] add beta --- Tasks/PCLCommunity.PCL2-CE.Beta/Config.yaml | 3 ++ Tasks/PCLCommunity.PCL2-CE.Beta/Script.ps1 | 53 +++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 Tasks/PCLCommunity.PCL2-CE.Beta/Config.yaml create mode 100644 Tasks/PCLCommunity.PCL2-CE.Beta/Script.ps1 diff --git a/Tasks/PCLCommunity.PCL2-CE.Beta/Config.yaml b/Tasks/PCLCommunity.PCL2-CE.Beta/Config.yaml new file mode 100644 index 0000000000..4be3af9eb3 --- /dev/null +++ b/Tasks/PCLCommunity.PCL2-CE.Beta/Config.yaml @@ -0,0 +1,3 @@ +Type: PackageTask +WinGetIdentifier: PCLCommunity.PCL2-CE.Beta +Skip: false diff --git a/Tasks/PCLCommunity.PCL2-CE.Beta/Script.ps1 b/Tasks/PCLCommunity.PCL2-CE.Beta/Script.ps1 new file mode 100644 index 0000000000..30a5203239 --- /dev/null +++ b/Tasks/PCLCommunity.PCL2-CE.Beta/Script.ps1 @@ -0,0 +1,53 @@ +$Object1 = (Invoke-GitHubApi -Uri "https://api.github.com/repos/PCL-Community/PCL-CE/releases").Where({ $_.prerelease -eq $true -and $_.tag_name.Contains('beta') }, 'First')[0] + +# Version +$this.CurrentState.Version = $Object1.tag_name -replace '^v' + +# Installer +$this.CurrentState.Installer += [ordered]@{ + Architecture = 'x64' + InstallerUrl = $Object1.assets.Where({ $_.name.EndsWith('.exe') -and $_.name.Contains('x64') }, 'First')[0].browser_download_url | ConvertTo-UnescapedUri +} +$this.CurrentState.Installer += [ordered]@{ + Architecture = 'arm64' + InstallerUrl = $Object1.assets.Where({ $_.name.EndsWith('.exe') -and $_.name.Contains('ARM64') }, 'First')[0].browser_download_url | ConvertTo-UnescapedUri +} + +switch -Regex ($this.Check()) { + 'New|Changed|Updated' { + try { + # ReleaseTime + $this.CurrentState.ReleaseTime = $Object1.published_at.ToUniversalTime() + + if (-not [string]::IsNullOrWhiteSpace($Object1.body)) { + # ReleaseNotes (zh-CN) + $this.CurrentState.Locale += [ordered]@{ + Locale = 'zh-CN' + Key = 'ReleaseNotes' + Value = $Object1.body | Convert-MarkdownToHtml -Extensions 'advanced', 'emojis', 'hardlinebreak' | Get-TextContent | Format-Text + } + } else { + $this.Log("No ReleaseNotes (zh-CN) for version $($this.CurrentState.Version)", 'Warning') + } + + # ReleaseNotesUrl (zh-CN) + $this.CurrentState.Locale += [ordered]@{ + Locale = 'zh-CN' + Key = 'ReleaseNotesUrl' + Value = $Object1.html_url + } + } catch { + $_ | Out-Host + $this.Log($_, 'Warning') + } + + $this.Print() + $this.Write() + } + 'Changed|Updated' { + $this.Message() + } + 'Updated' { + $this.Submit() + } +}