From 5f9bc0fa97d1ca9ee18920828fc575d3f2c6168e Mon Sep 17 00:00:00 2001 From: Jan Braje <12571346+janluak@users.noreply.github.com> Date: Mon, 20 Jul 2026 15:56:28 +0200 Subject: [PATCH] change order to avoid failing saving commands Signed-off-by: Jan Braje <12571346+janluak@users.noreply.github.com> --- pkg/action/bump.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/action/bump.go b/pkg/action/bump.go index 9085e14da..082ad70b2 100644 --- a/pkg/action/bump.go +++ b/pkg/action/bump.go @@ -105,15 +105,16 @@ func (b *Bump) Run(bumpType string, chartpath string) (string, error) { newVersion = *version } - b.chart.Metadata.Version = newVersion.String() - - // Save the updated chart to disk (this will update Chart.yaml) + newVersionStr := newVersion.String() if chartpath != "" { - err = util.SaveChartfile(filepath.Join(chartpath, "Chart.yaml"), b.chart.Metadata) - if err != nil { + md := *b.chart.Metadata + md.Version = newVersionStr + if err := util.SaveChartfile(filepath.Join(chartpath, "Chart.yaml"), &md); err != nil { return "", fmt.Errorf("failed to save updated chart: %w", err) } } + b.chart.Metadata.Version = newVersionStr + return b.chart.Metadata.Version, nil }