Compare commits

..

1 Commits

Author SHA1 Message Date
67108511c1 Get vack to distroless
All checks were successful
continuous-integration/drone/push Build is passing
2025-03-29 23:07:20 +03:00
7 changed files with 13 additions and 55 deletions

View File

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

View File

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

View File

@@ -1,28 +1,11 @@
NAMESPACE ?= golang EXEC=bumpversion.run
PACKAGE := bumpversion
SHELL := /bin/bash
REGISTRY := registry.halfakop.ru
REPOSITORY := $(NAMESPACE)/$(PACKAGE)
SOURCE_VERSION ?= $(shell cat VERSION) all: build
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: fix:
@go fix ./... @go fix ./...
app: fix build: fix
@go build -o ./${EXEC} ./src @go build -o ./${EXEC} ./src
tests: build tests: build
@@ -34,24 +17,5 @@ run:
clean: clean:
@rm -rf ./${EXEC}% @rm -rf ./${EXEC}%
release: title clean build login push image:
docker build --compress -t rad/bumpversion:latest -f Dockerfile .
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.1 # BumpVersion v0.1.0
[![Build Status](https://drone.halfakop.ru/api/badges/rad/bumpversion/status.svg)](https://drone.halfakop.ru/rad/bumpversion) [![Build Status](https://drone.halfakop.ru/api/badges/rad/bumpversion/status.svg)](https://drone.halfakop.ru/rad/bumpversion)

View File

@@ -1 +1 @@
0.1.1 0.1.0

2
go.mod
View File

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

View File

@@ -130,13 +130,9 @@ func updateFiles(filePaths []string, oldVersion, newVersion string) {
func updateConfigFile(configPath string, newVersion string) error { func updateConfigFile(configPath string, newVersion string) error {
cfg, err := ini.Load(configPath) cfg, err := ini.Load(configPath)
if err != nil { if err != nil {
return fmt.Errorf("failed to load config: %w", err) return err
} }
sec, err := cfg.GetSection("bumpversion") cfg.Section("bumpversion").Key("current_version").SetValue(newVersion)
if err != nil {
return fmt.Errorf("section [bumpversion] not found: %w", err)
}
sec.Key("current_version").SetValue(newVersion)
return cfg.SaveTo(configPath) return cfg.SaveTo(configPath)
} }
@@ -162,7 +158,7 @@ func resolveFlag(positive, negative *bool, defaultValue bool) bool {
// Версия приложения // Версия приложения
const ( const (
AppName = "BumpVersion" AppName = "BumpVersion"
AppVersion = "0.1.1" AppVersion = "0.1.0"
) )
func main() { func main() {
@@ -229,7 +225,5 @@ func main() {
// Обновляем конфигурационный файл // Обновляем конфигурационный файл
if err := updateConfigFile(cfg_name, newVersion); err != nil { if err := updateConfigFile(cfg_name, newVersion); err != nil {
log.Printf("Error updating config file: %v", err) log.Printf("Error updating config file: %v", err)
} else {
log.Printf("Config file %s updated to version %s", cfg_name, newVersion)
} }
} }