Skip to content

Commit 7073bb5

Browse files
committed
feat: Add git tag support to release workflow
- Add 'tag-version' target to create annotated git tags - Add 'create-release' target for complete release workflow - Enhance 'bump-version' with reminders about CHANGELOG and tagging - Tag format: vX.Y.Z (e.g., v0.0.10) - Prevents duplicate tags with validation - Provides helpful reminders for manual steps Usage: make tag-version # Create tag for current version make create-release VERSION=0.1.0 # Full release workflow
1 parent 1bd751a commit 7073bb5

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,42 @@ bump-version: ## Bump version (use VERSION=0.1.0)
215215
@sed -i '' 's/version = ".*"/version = "$(VERSION)"/' Cargo.toml
216216
@cargo check
217217
@echo "$(BOLD)$(GREEN)✓ Version bumped to $(VERSION)$(RESET)"
218+
@echo "$(YELLOW)⚠ Don't forget to update CHANGELOG.md and commit changes$(RESET)"
219+
@echo "$(YELLOW)⚠ Then run 'make tag-version' to create a git tag$(RESET)"
220+
221+
tag-version: ## Create an annotated git tag for the current version
222+
@VERSION=$$(grep '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/'); \
223+
echo "$(BOLD)$(MAGENTA)Creating tag v$$VERSION...$(RESET)"; \
224+
if git rev-parse "v$$VERSION" >/dev/null 2>&1; then \
225+
echo "$(RED)✗ Tag v$$VERSION already exists$(RESET)"; \
226+
exit 1; \
227+
fi; \
228+
git tag -a "v$$VERSION" -m "Release version $$VERSION"; \
229+
echo "$(BOLD)$(GREEN)✓ Created tag v$$VERSION$(RESET)"; \
230+
echo "$(YELLOW)⚠ Push the tag with: git push origin v$$VERSION$(RESET)"
231+
232+
create-release: ## Complete release workflow (bump, tag, and prepare)
233+
@echo "$(BOLD)$(CYAN)Starting release workflow...$(RESET)"
234+
@echo ""
235+
@if [ -z "$(VERSION)" ]; then \
236+
echo "$(RED)Error: VERSION not specified$(RESET)"; \
237+
echo "Usage: make create-release VERSION=0.1.0"; \
238+
exit 1; \
239+
fi
240+
@echo "$(BOLD)Step 1: Bump version$(RESET)"
241+
@$(MAKE) bump-version VERSION=$(VERSION)
242+
@echo ""
243+
@echo "$(BOLD)Step 2: Run CI checks$(RESET)"
244+
@$(MAKE) ci-local
245+
@echo ""
246+
@echo "$(BOLD)$(YELLOW)Manual steps required:$(RESET)"
247+
@echo " 1. Update CHANGELOG.md with release notes"
248+
@echo " 2. Review changes: git diff"
249+
@echo " 3. Commit: git add -A && git commit -m 'chore: Bump version to $(VERSION)'"
250+
@echo " 4. Create tag: make tag-version"
251+
@echo " 5. Push: git push && git push --tags"
252+
@echo ""
253+
@echo "$(BOLD)$(GREEN)Version bumped and tested. Complete manual steps above.$(RESET)"
218254

219255
# === Testing Helpers ===
220256

0 commit comments

Comments
 (0)