Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions Tasks/MichalTrojnara.osslsigncode/Config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Type: PackageTask
WinGetIdentifier: MichalTrojnara.osslsigncode
Skip: false
Notes: >
This is a temporary resolution. Already asked the original author if he/she is
willing to integrate WinGet Releaser into his/her GitHub Workflows.
51 changes: 51 additions & 0 deletions Tasks/MichalTrojnara.osslsigncode/Script.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
$RepoOwner = 'mtrojnar'
$RepoName = 'osslsigncode'

$Object1 = Invoke-GitHubApi -Uri "https://api.github.com/repos/${RepoOwner}/${RepoName}/releases/latest"

# Version
$this.CurrentState.Version = $Object1.tag_name -creplace '^v'

# Installer
$this.CurrentState.Installer += [ordered]@{
Architecture = 'x64'
InstallerUrl = $Object1.assets.Where({ $_.name.EndsWith('.zip') -and $_.name.Contains('windows') -and $_.name.Contains('x64') }, '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 (en-US)
$this.CurrentState.Locale += [ordered]@{
Locale = 'en-US'
Key = 'ReleaseNotes'
Value = $Object1.body | Convert-MarkdownToHtml -Extensions 'advanced', 'emojis', 'hardlinebreak' | Get-TextContent | Format-Text
}
} else {
$this.Log("No ReleaseNotes (en-US) for version $($this.CurrentState.Version)", 'Warning')
}

# ReleaseNotesUrl
$this.CurrentState.Locale += [ordered]@{
Key = 'ReleaseNotesUrl'
Value = $Object1.html_url
}
} catch {
$_ | Out-Host
$this.Log($_, 'Warning')
}

$this.Print()
$this.Write()
}
'Changed|Updated' {
$this.Message()
}
'Updated' {
$this.Submit()
}
}