|
| 1 | +VERSION ?= v0.1.0 |
| 2 | +BRANCH_DEV = dev |
| 3 | +BRANCH_MAIN = main |
| 4 | + |
| 5 | +.PHONY: help release commit push merge tag test changelog |
| 6 | + |
| 7 | +help: |
| 8 | + @echo "Available commands:" |
| 9 | + @echo " make commit - Add and commit all files (on $(BRANCH_DEV) branch)" |
| 10 | + @echo " make push - Push the $(BRANCH_DEV) branch" |
| 11 | + @echo " make merge - Merge $(BRANCH_DEV) into $(BRANCH_MAIN)" |
| 12 | + @echo " make tag VERSION=vX.Y.Z - Create and push a Git tag (default: $(VERSION))" |
| 13 | + @echo " make release VERSION=vX.Y.Z - Full release: changelog + commit + push + merge + tag" |
| 14 | + @echo " make test - Compile and run tests" |
| 15 | + @echo " make changelog - Update CHANGELOG.md using script" |
| 16 | + |
| 17 | +commit: |
| 18 | + git checkout $(BRANCH_DEV) |
| 19 | + @if [ -n "$$(git status --porcelain)" ]; then \ |
| 20 | + echo "📝 Committing changes..."; \ |
| 21 | + git add .; \ |
| 22 | + git commit -m "chore(release): prepare $(VERSION)"; \ |
| 23 | + else \ |
| 24 | + echo "✅ Nothing to commit."; \ |
| 25 | + fi |
| 26 | + |
| 27 | +push: |
| 28 | + git push origin $(BRANCH_DEV) |
| 29 | + |
| 30 | +merge: |
| 31 | + git checkout $(BRANCH_MAIN) |
| 32 | + git merge --no-ff --no-edit $(BRANCH_DEV) |
| 33 | + git push origin $(BRANCH_MAIN) |
| 34 | + |
| 35 | +tag: |
| 36 | + @if git rev-parse $(VERSION) >/dev/null 2>&1; then \ |
| 37 | + echo "❌ Tag $(VERSION) already exists."; \ |
| 38 | + exit 1; \ |
| 39 | + else \ |
| 40 | + echo "🏷️ Creating annotated tag $(VERSION)..."; \ |
| 41 | + git tag -a $(VERSION) -m "Release version $(VERSION)"; \ |
| 42 | + git push origin $(VERSION); \ |
| 43 | + fi |
| 44 | + |
| 45 | +release: |
| 46 | + make changelog |
| 47 | + make commit |
| 48 | + make push |
| 49 | + make merge |
| 50 | + make tag VERSION=$(VERSION) |
| 51 | + |
| 52 | +test: |
| 53 | + cd build && ctest --output-on-failure |
| 54 | + |
| 55 | +changelog: |
| 56 | + bash scripts/update_changelog.sh |
0 commit comments