Skip to content

Commit c5e5620

Browse files
committed
Prerelease option added
Signed-off-by: Manish Gupta <manish@plane.so>
1 parent 99c6a9a commit c5e5620

7 files changed

Lines changed: 8 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ Flags:
107107
-t, --token string GitHub Auth Token
108108
--make-release-latest bool Mark the created GitHub release as 'latest' (default "true")
109109
--packages-with-index Host the package files in the GitHub Pages branch
110+
--prerelease Mark this as 'Pre-release'
110111

111112
Global Flags:
112113
--config string Config file (default is $HOME/.cr.yaml)

cr/cmd/upload.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,5 @@ func init() {
6262
uploadCmd.Flags().Bool("push", false, "Push the chart package to the GitHub Pages branch (must not be set if --pr is set)")
6363
uploadCmd.Flags().Bool("pr", false, "Create a pull request for the chart package against the GitHub Pages branch (must not be set if --push is set)")
6464
uploadCmd.Flags().Bool("packages-with-index", false, "Host the package files in the GitHub Pages branch")
65+
uploadCmd.Flags().Bool("prerelease", false, "Mark this as 'Pre-release'")
6566
}

doc/cr_upload.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ cr upload [flags]
2525
--packages-with-index Host the package files in the GitHub Pages branch
2626
--pages-branch string The GitHub pages branch (default "gh-pages")
2727
--pr Create a pull request for the chart package against the GitHub Pages branch (must not be set if --push is set)
28+
--prerelease Mark this as 'Pre-release'
2829
--push Push the chart package to the GitHub Pages branch (must not be set if --pr is set)
2930
--release-name-template string Go template for computing release names, using chart metadata (default "{{ .Name }}-{{ .Version }}")
3031
--release-notes-file string Markdown file with chart release notes. If it is set to empty string, or the file is not found, the chart description will be used instead. The file is read from the chart package

pkg/config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ type Options struct {
6262
GenerateReleaseNotes bool `mapstructure:"generate-release-notes"`
6363
MakeReleaseLatest bool `mapstructure:"make-release-latest"`
6464
PackagesWithIndex bool `mapstructure:"packages-with-index"`
65+
Prerelease bool `mapstructure:"prerelease"`
6566
}
6667

6768
func LoadConfiguration(cfgFile string, cmd *cobra.Command, requiredFlags []string) (*Options, error) {

pkg/github/github.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type Release struct {
3636
Commit string
3737
GenerateReleaseNotes bool
3838
MakeLatest string
39+
Prerelease bool
3940
}
4041

4142
type Asset struct {
@@ -111,6 +112,7 @@ func (c *Client) CreateRelease(_ context.Context, input *Release) error {
111112
TargetCommitish: &input.Commit,
112113
GenerateReleaseNotes: &input.GenerateReleaseNotes,
113114
MakeLatest: &input.MakeLatest,
115+
Prerelease: &input.Prerelease,
114116
}
115117

116118
release, _, err := c.Repositories.CreateRelease(context.TODO(), c.owner, c.repo, req)

pkg/releaser/releaser.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ func (r *Releaser) CreateReleases() error {
317317
Commit: r.config.Commit,
318318
GenerateReleaseNotes: r.config.GenerateReleaseNotes,
319319
MakeLatest: strconv.FormatBool(r.config.MakeReleaseLatest),
320+
Prerelease: r.config.Prerelease,
320321
}
321322
provFile := fmt.Sprintf("%s.prov", p)
322323
if _, err := os.Stat(provFile); err == nil {

pkg/releaser/releaser_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ func (f *FakeGitHub) GetRelease(ctx context.Context, tag string) (*github.Releas
106106
URL: "https://myrepo/charts/third-party-file-0.1.0.txt",
107107
},
108108
},
109+
Prerelease: false,
109110
}
110111
return release, nil
111112
}

0 commit comments

Comments
 (0)