Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(publisher): support profile for tiup publications #217

Merged
merged 1 commit into from
Dec 30, 2024
Merged
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: 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
Loading