feat: signed releases, release feed, notification (read-only)

This commit is contained in:
fsylvain committed 2026-10-01 15:01:53 +02:00
1 parent a49eec909c
commit 834493a4f5
49 files changed
+4191 -18

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
package update
import (
"regexp"
"strings"
"time"
)
var (
bulletLine = regexp.MustCompile(`^[-*+]\s+(.+)$`)
markdownLink = regexp.MustCompile(`!?\[([^\]]*)\]\([^)]*\)`)
boldText = regexp.MustCompile(`\*\*([^*]+)\*\*|__([^_]+)__`)
italicText = regexp.MustCompile(`\*([^*\s][^*]*)\*`)
inlineCode = regexp.MustCompile("`([^`]*)`")
)
func BuildNotes(tag string, publishedAt time.Time, body string) ReleaseNotes {
items := []string{}
for _, line := range strings.Split(body, "\n") {
match := bulletLine.FindStringSubmatch(strings.TrimSpace(line))
if match == nil {
continue
}
if item := plainText(match[1]); item != "" {
items = append(items, item)
}
}
return ReleaseNotes{Version: tag, ReleasedAt: publishedAt, Items: items}
}
func plainText(markdown string) string {
text := markdownLink.ReplaceAllString(markdown, "$1")
text = boldText.ReplaceAllString(text, "$1$2")
text = italicText.ReplaceAllString(text, "$1")
text = inlineCode.ReplaceAllString(text, "$1")
return strings.TrimSpace(text)
}