Skip to content

Commit f6a41c8

Browse files
committed
Enhance Makefile with version management and release tagging functionality
1 parent b9ff51c commit f6a41c8

1 file changed

Lines changed: 48 additions & 1 deletion

File tree

Makefile

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ shell := /bin/bash
22

33
COMPOSE = docker compose
44

5+
# Version management
6+
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "No tags found")
7+
8+
# Docker Hub settings (for reference only)
9+
UPDATER_IMAGE ?= $(DOCKER_REGISTRY)/$(DOCKER_USER)/docker-swarm-autoupdater-updater
10+
TRIGGER_IMAGE ?= $(DOCKER_REGISTRY)/$(DOCKER_USER)/docker-swarm-autoupdater-trigger
11+
512
.PHONY: help
613
help: ## help message, list all commands
714
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"
@@ -20,4 +27,44 @@ shell-%: ## run shell in container
2027

2128
.PHONY: test-request
2229
test-request: ## send test request to webhook
23-
curl http://localhost:8080/update-Nohn0lahGh5ahnaeng9Xolaewu2fae
30+
curl http://localhost:8080/update-Nohn0lahGh5ahnaeng9Xolaewu2fae
31+
32+
# Version and release management
33+
.PHONY: release
34+
release: ## create a new release tag (interactive)
35+
@echo "=== Current Version ==="
36+
@echo "$(VERSION)"
37+
@echo ""
38+
@echo "=== Recent Tags ==="
39+
@git tag -l | tail -5 || echo "No tags found"
40+
@echo ""
41+
@echo -n "Enter new version (e.g., v1.0.0): "
42+
@read NEW_VERSION; \
43+
if [ -z "$$NEW_VERSION" ]; then \
44+
echo "No version provided. Aborting."; \
45+
exit 1; \
46+
fi; \
47+
if [[ "$$NEW_VERSION" != v* ]]; then \
48+
echo "Version must start with 'v' (e.g., v1.0.0)"; \
49+
exit 1; \
50+
fi; \
51+
echo "Creating tag $$NEW_VERSION..."; \
52+
git tag -a $$NEW_VERSION -m "Release $$NEW_VERSION"; \
53+
echo "Tag $$NEW_VERSION created"; \
54+
echo "Push it git push --tags, so GitHub Actions will build and publish the Docker images."
55+
56+
# Development helpers
57+
.PHONY: clean
58+
clean: ## remove local docker images and containers
59+
$(COMPOSE) down --volumes --rmi local 2>/dev/null || true
60+
61+
.PHONY: status
62+
status: ## show git and docker status
63+
@echo "=== Git Status ==="
64+
@git status --porcelain
65+
@echo ""
66+
@echo "=== Current Version ==="
67+
@echo "$(VERSION)"
68+
@echo ""
69+
@echo "=== Recent Tags ==="
70+
@git tag -l | tail -5 || echo "No tags found"

0 commit comments

Comments
 (0)