Skip to content

Commit

Permalink
feat(publisher): support profile for tiup publications (#217)
Browse files Browse the repository at this point in the history
Signed-off-by: wuhuizuo <[email protected]>

Signed-off-by: wuhuizuo <[email protected]>
  • Loading branch information
wuhuizuo authored Dec 30, 2024
1 parent 63fc485 commit 63c6b7f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions publisher/pkg/impl/funcs_tiup.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const nightlyVerSuffix = "-nightly"
var (
pkgNameRegex = regexp.MustCompile(`^(.+)-v\d+\.\d+\.\d+`)
pkgVersionNightlyRegex = regexp.MustCompile(`(-\d+-g[0-9a-f]{7,})$`)
ociGATagRegex = regexp.MustCompile(`^(v\d+\.\d+\.\d+)_(linux|darwin)_(amd64|arm64)$`)
ociGATagRegex = regexp.MustCompile(`^(v\d+\.\d+\.\d+)(-\w+-)?_(linux|darwin)_(amd64|arm64)$`)
ociNightlyTagRegex = regexp.MustCompile(`^(master|main)_(linux|darwin)_(amd64|arm64)$`)
tiupVersionRegex = regexp.MustCompile(`^v\d+\.\d+\.\d+.*(-nightly)$`)
)
Expand Down Expand Up @@ -160,7 +160,9 @@ func tiupPkgName(tarballPath string) string {
func transformTiupVer(version, tag string) string {
switch {
case ociGATagRegex.MatchString(tag): // GA case
return strings.TrimSuffix(version, "-pre")
// ociGATagRegex = regexp.MustCompile(`^(v\d+\.\d+\.\d+)(-\w+)?_(linux|darwin)_(amd64|arm64)$`)
matches := ociGATagRegex.FindStringSubmatch(tag)
return strings.Join(matches[1:2], "")
case ociNightlyTagRegex.MatchString(tag): // Nightly case
// we replace the suffix part of version: '-[0-9]+-g[0-9a-f]+$' to "-nightly"
return pkgVersionNightlyRegex.ReplaceAllString(version, "") + nightlyVerSuffix
Expand Down

0 comments on commit 63c6b7f

Please sign in to comment.