Ensure configuration update

This commit is contained in:
2025-04-04 00:38:10 +03:00
parent 052cd0edf3
commit 93abb9158d

View File

@@ -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)
}
}