-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (47 loc) · 1.54 KB
/
Makefile
File metadata and controls
56 lines (47 loc) · 1.54 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
VERSION ?= v0.1.0
BRANCH_DEV = dev
BRANCH_MAIN = main
.PHONY: help release commit push merge tag test changelog
help:
@echo "Available commands:"
@echo " make commit - Add and commit all files (on $(BRANCH_DEV) branch)"
@echo " make push - Push the $(BRANCH_DEV) branch"
@echo " make merge - Merge $(BRANCH_DEV) into $(BRANCH_MAIN)"
@echo " make tag VERSION=vX.Y.Z - Create and push a Git tag (default: $(VERSION))"
@echo " make release VERSION=vX.Y.Z - Full release: changelog + commit + push + merge + tag"
@echo " make test - Compile and run tests"
@echo " make changelog - Update CHANGELOG.md using script"
commit:
git checkout $(BRANCH_DEV)
@if [ -n "$$(git status --porcelain)" ]; then \
echo "📝 Committing changes..."; \
git add .; \
git commit -m "chore(release): prepare $(VERSION)"; \
else \
echo "✅ Nothing to commit."; \
fi
push:
git push origin $(BRANCH_DEV)
merge:
git checkout $(BRANCH_MAIN)
git merge --no-ff --no-edit $(BRANCH_DEV)
git push origin $(BRANCH_MAIN)
tag:
@if git rev-parse $(VERSION) >/dev/null 2>&1; then \
echo "❌ Tag $(VERSION) already exists."; \
exit 1; \
else \
echo "🏷️ Creating annotated tag $(VERSION)..."; \
git tag -a $(VERSION) -m "Release version $(VERSION)"; \
git push origin $(VERSION); \
fi
release:
make changelog
make commit
make push
make merge
make tag VERSION=$(VERSION)
test:
cd build && ctest --output-on-failure
changelog:
bash scripts/update_changelog.sh