set_image

package
v0.77.0-dev-1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:     "version-bump",
	Short:   "Set version in Helm Chart",
	Aliases: []string{"vb"},
	Args:    cobra.NoArgs,
	Run: func(c *cobra.Command, args []string) {
		data, _ := os.ReadFile(FlagFile)
		s := replace(string(data), "version", FlagVersion)
		os.WriteFile(FlagFile, []byte(s), 0644)

		if CmdFlagNoCommit {
			return
		}

		r, err := git.PlainOpen(".")
		if err != nil {
			panic(err)
		}
		w, err := r.Worktree()
		if err != nil {
			panic(err)
		}
		_, err = w.Add(FlagFile)
		if err != nil {
			panic(err)
		}

		scope := ""
		if FlagScope != "" {
			scope = "(" + FlagScope + ")"
		}

		commit, _ := w.Commit("VERSION"+scope+": "+FlagVersion, &git.CommitOptions{})
		_, err = r.CommitObject(commit)
		if err != nil {
			panic(err)
		}

		if CmdFlagTag {
			_, err := r.CreateTag(
				FlagVersion,
				commit,
				&git.CreateTagOptions{
					Message: "VERSION" + scope + ": " + FlagVersion,
				},
			)
			if err != nil {
				panic(err)
			}
		}
	},
}
View Source
var CmdFlagNoCommit bool
View Source
var CmdFlagTag bool
View Source
var FlagFile string
View Source
var FlagScope string
View Source
var FlagVersion string

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL