-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (50 loc) · 1.86 KB
/
Makefile
File metadata and controls
61 lines (50 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
IMAGE ?= agentbox
TAG ?= latest
FULL_IMAGE := $(IMAGE):$(TAG)
REGISTRY ?= ghcr.io
GHCR_OWNER ?= $(shell whoami)
GHCR_IMAGE := $(REGISTRY)/$(GHCR_OWNER)/$(IMAGE):$(TAG)
.PHONY: help up down enter-% build dual-tag tag-ghcr bump-patch bump-minor push
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-14s\033[0m %s\n", $$1, $$2}'
up: ## Start all services in detached mode
docker compose up -d
down: ## Stop and remove services
docker compose down
enter-%: ## Enter tmux in the named agent container (usage: make enter-<name>)
docker exec -u agent -it agent-$* tmux new -As0
build: ## Build Docker image
docker build -t $(FULL_IMAGE) .
dual-tag: build ## Tag image as ghcr.io/<user>/<image>:<tag>
docker tag $(FULL_IMAGE) $(GHCR_IMAGE)
tag-ghcr: dual-tag ## Convenience alias for dual-tag
bump-minor: ## Bump minor version and create git tag
@OLD=$$(cat VERSION); \
MAJOR=$$(echo $$OLD | cut -d. -f1); \
MINOR=$$(echo $$OLD | cut -d. -f2); \
NEW="$$MAJOR.$$((MINOR + 1)).0"; \
echo $$NEW > VERSION; \
git add VERSION; \
git commit -m "Bump version to $$NEW"; \
git tag "v$$NEW"; \
echo "Bumped version: $$OLD -> $$NEW (tagged v$$NEW)"
bump-patch: ## Bump patch version and create git tag
@OLD=$$(cat VERSION); \
MAJOR=$$(echo $$OLD | cut -d. -f1); \
MINOR=$$(echo $$OLD | cut -d. -f2); \
PATCH=$$(echo $$OLD | cut -d. -f3); \
NEW="$$MAJOR.$$MINOR.$$((PATCH + 1))"; \
echo $$NEW > VERSION; \
git add VERSION; \
git commit -m "Bump version to $$NEW"; \
git tag "v$$NEW"; \
echo "Bumped version: $$OLD -> $$NEW (tagged v$$NEW)"
push: ## Push commits and current tag to origin
@TAG=$$(git describe --tags --exact-match 2>/dev/null); \
git push origin main; \
if [ -n "$$TAG" ]; then \
echo "Pushing tag $$TAG..."; \
git push origin "$$TAG"; \
else \
echo "No tag on current commit"; \
fi