Skip to content

Commit

Permalink
Fix tag pattern for index command (helm#24)
Browse files Browse the repository at this point in the history
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
  • Loading branch information
mumoshu authored and unguiculus committed Feb 22, 2019
1 parent 734f439 commit 1b0d3e6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/index/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ func Create(config *config.Options) error {
//fmt.Printf("found release %s\n", *r.TagName)
var packageName, packageVersion, packageURL string
for _, f := range r.Assets {
tagParts := strings.Split(*r.TagName, "+")
if len(tagParts) == 2 && *f.Name == fmt.Sprintf("%s-%s.tgz", tagParts[1], tagParts[0]) {
tagParts := splitPackageNameAndVersion(*r.TagName)
if len(tagParts) == 2 && *f.Name == fmt.Sprintf("%s-%s.tgz", tagParts[0], tagParts[1]) {
p := strings.TrimSuffix(*f.Name, filepath.Ext(*f.Name))
ps := strings.Split(p, "-")
ps := splitPackageNameAndVersion(p)
packageName, packageVersion = ps[0], ps[1]
packageURL = *f.BrowserDownloadURL

Expand All @@ -109,6 +109,11 @@ func Create(config *config.Options) error {

}

func splitPackageNameAndVersion(pkg string) []string {
delimIndex := strings.LastIndex(pkg, "-")
return []string{pkg[0:delimIndex], pkg[delimIndex+1:]}
}

func addToIndexFile(indexFile *repo.IndexFile, url string) {
// fetch package to temp url so we can extract metadata and stuff
dir, err := ioutil.TempDir("", "chart-releaser")
Expand Down

0 comments on commit 1b0d3e6

Please # to comment.