xtool/cppkg: support latest version

This commit is contained in:
xushiwei
2025-05-04 17:34:02 +08:00
parent 2e19c2013c
commit 8455ee8226
5 changed files with 53 additions and 13 deletions

View File

@@ -75,7 +75,10 @@ type githubRelease struct {
func getRelease(pkg *Package, tagPattern string) (ret *githubRelease, err error) {
if tagPattern == "" {
return nil, errors.New("dynamic tag")
return nil, ErrDynamicTag
}
if pkg.gr != nil {
return &githubRelease{PublishedAt: pkg.gr.PublishedAt}, nil
}
ver := strings.Replace(tagPattern, "*", pkg.Version, 1)
gr, err := github.GetRelease(pkg.Path, ver)