Ensure configuration update
This commit is contained in:
10
src/main.go
10
src/main.go
@@ -130,9 +130,13 @@ func updateFiles(filePaths []string, oldVersion, newVersion string) {
|
||||
func updateConfigFile(configPath string, newVersion string) error {
|
||||
cfg, err := ini.Load(configPath)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("failed to load config: %w", err)
|
||||
}
|
||||
cfg.Section("bumpversion").Key("current_version").SetValue(newVersion)
|
||||
sec, err := cfg.GetSection("bumpversion")
|
||||
if err != nil {
|
||||
return fmt.Errorf("section [bumpversion] not found: %w", err)
|
||||
}
|
||||
sec.Key("current_version").SetValue(newVersion)
|
||||
return cfg.SaveTo(configPath)
|
||||
}
|
||||
|
||||
@@ -225,5 +229,7 @@ func main() {
|
||||
// Обновляем конфигурационный файл
|
||||
if err := updateConfigFile(cfg_name, newVersion); err != nil {
|
||||
log.Printf("Error updating config file: %v", err)
|
||||
} else {
|
||||
log.Printf("Config file %s updated to version %s", cfg_name, newVersion)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user