Skip to content

Commit 358754e

Browse files
committed
Add Podman.CLI
1 parent 24b53e4 commit 358754e

2 files changed

Lines changed: 59 additions & 0 deletions

File tree

Tasks/Podman.CLI/Config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Type: PackageTask
2+
WinGetIdentifier: Podman.CLI
3+
Skip: false

Tasks/Podman.CLI/Script.ps1

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
$RepoOwner = 'containers'
2+
$RepoName = 'podman'
3+
4+
$Object1 = Invoke-GitHubApi -Uri "https://api.github.com/repos/${RepoOwner}/${RepoName}/releases/latest"
5+
6+
# Version
7+
$this.CurrentState.Version = $Object1.tag_name -creplace '^v'
8+
9+
# Installer
10+
$this.CurrentState.Installer += [ordered]@{
11+
Architecture = 'x64'
12+
InstallerUrl = $Object1.assets.Where({ $_.name.EndsWith('.msi') -and $_.name -match 'installer' -and $_.name -match 'amd64' }, 'First')[0].browser_download_url | ConvertTo-UnescapedUri
13+
}
14+
$this.CurrentState.Installer += [ordered]@{
15+
Architecture = 'arm64'
16+
InstallerUrl = $Object1.assets.Where({ $_.name.EndsWith('.msi') -and $_.name -match 'installer' -and $_.name -match 'arm64' }, 'First')[0].browser_download_url | ConvertTo-UnescapedUri
17+
}
18+
19+
switch -Regex ($this.Check()) {
20+
'New|Changed|Updated' {
21+
try {
22+
# ReleaseTime
23+
$this.CurrentState.ReleaseTime = $Object1.published_at.ToUniversalTime()
24+
25+
if (-not [string]::IsNullOrWhiteSpace($Object1.body)) {
26+
# ReleaseNotes (en-US)
27+
$this.CurrentState.Locale += [ordered]@{
28+
Locale = 'en-US'
29+
Key = 'ReleaseNotes'
30+
Value = $Object1.body | Convert-MarkdownToHtml -Extensions 'advanced', 'emojis', 'hardlinebreak' | Get-TextContent | Format-Text
31+
}
32+
} else {
33+
$this.Log("No ReleaseNotes (en-US) for version $($this.CurrentState.Version)", 'Warning')
34+
}
35+
36+
# ReleaseNotesUrl (en-US)
37+
$this.CurrentState.Locale += [ordered]@{
38+
Locale = 'en-US'
39+
Key = 'ReleaseNotesUrl'
40+
Value = $Object1.html_url
41+
}
42+
} catch {
43+
$_ | Out-Host
44+
$this.Log($_, 'Warning')
45+
}
46+
47+
$this.Print()
48+
$this.Write()
49+
}
50+
'Changed|Updated' {
51+
$this.Message()
52+
}
53+
'Updated' {
54+
$this.Submit()
55+
}
56+
}

0 commit comments

Comments
 (0)