Compare commits

..

4 Commits

Author SHA1 Message Date
210ed25805 [skip ci] Bump version: 0.1.0 → 0.1.1
All checks were successful
continuous-integration/drone/tag Build is passing
2025-04-04 00:41:16 +03:00
e5be089935 Improve development 2025-04-04 00:38:28 +03:00
93abb9158d Ensure configuration update 2025-04-04 00:38:10 +03:00
052cd0edf3 Get back to distroless 2025-03-29 23:08:16 +03:00
7 changed files with 55 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.0
current_version = 0.1.1
commit = True
tag = True
tag_name = {new_version}

View File

@@ -15,7 +15,7 @@ steps:
path: /var/run/docker.sock
settings:
dockerfile: Dockerfile
tags: 0.1.0
tags: 0.1.1
force_tag: true
registry: registry.halfakop.ru
repo: registry.halfakop.ru/golang/bumpversion

View File

@@ -1,11 +1,28 @@
EXEC=bumpversion.run
NAMESPACE ?= golang
PACKAGE := bumpversion
SHELL := /bin/bash
REGISTRY := registry.halfakop.ru
REPOSITORY := $(NAMESPACE)/$(PACKAGE)
all: build
SOURCE_VERSION ?= $(shell cat VERSION)
SOURCE_COMMIT ?= $(shell git rev-parse --short=8 HEAD)
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD | sed s,feature/,,g)
IMAGE_NAME_TAGGED = $(REPOSITORY):$(SOURCE_VERSION)
EXEC=$(PACKAGE).run
all: help
help:
@echo "app - build the application"
@echo "tests - run tests"
@echo "run - run application locally"
@echo "clean - clean build environment"
fix:
@go fix ./...
build: fix
app: fix
@go build -o ./${EXEC} ./src
tests: build
@@ -17,5 +34,24 @@ run:
clean:
@rm -rf ./${EXEC}%
image:
docker build --compress -t rad/bumpversion:latest -f Dockerfile .
release: title clean build login push
build:
docker build --compress \
-t $(IMAGE_NAME_TAGGED) \
-t $(REGISTRY)/$(IMAGE_NAME_TAGGED) \
--build-arg SOURCE_VERSION=$(SOURCE_VERSION) \
--build-arg SOURCE_COMMIT=$(SOURCE_COMMIT) \
${DOCKER_OPTS} \
-f Dockerfile .
login:
$(call check-var-defined,DOCKER_USERNAME)
$(call check-var-defined,DOCKER_PASSWORD)
@echo ${DOCKER_PASSWORD} | \
docker login -u ${DOCKER_USERNAME} --password-stdin $(REGISTRY)
push:
docker push $(REGISTRY)/$(IMAGE_NAME_TAGGED)
.PHONY: tests release build login push

View File

@@ -1,4 +1,4 @@
# BumpVersion v0.1.0
# BumpVersion v0.1.1
[![Build Status](https://drone.halfakop.ru/api/badges/rad/bumpversion/status.svg)](https://drone.halfakop.ru/rad/bumpversion)

View File

@@ -1 +1 @@
0.1.0
0.1.1

2
go.mod
View File

@@ -1,4 +1,4 @@
module src
module bumpversion
go 1.24.0

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)
}
@@ -158,7 +162,7 @@ func resolveFlag(positive, negative *bool, defaultValue bool) bool {
// Версия приложения
const (
AppName = "BumpVersion"
AppVersion = "0.1.0"
AppVersion = "0.1.1"
)
func main() {
@@ -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)
}
}