-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
26 lines (23 loc) · 1.03 KB
/
Makefile
File metadata and controls
26 lines (23 loc) · 1.03 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
# Current version from Cargo.toml
CURRENT_VERSION := $(shell grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
.PHONY: install_cli bump_version
install_cli:
cargo install --path . --locked
## bump_version: Bump the version in Cargo.toml and create a git tag.
## Usage: make bump_version VERSION=0.3.0
bump_version:
ifndef VERSION
$(error VERSION is required. Usage: make bump_version VERSION=0.3.0)
endif
@if git tag | grep -qx "v$(VERSION)"; then \
echo "Tag v$(VERSION) already exists — aborting."; exit 1; \
fi
@echo "Bumping version: $(CURRENT_VERSION) -> $(VERSION)"
@sed -i.bak 's/^version = "$(subst .,\.,$(CURRENT_VERSION))"/version = "$(VERSION)"/' Cargo.toml && rm -f Cargo.toml.bak
@cargo check --quiet || (echo "cargo check failed — version bump aborted"; exit 1)
@git add Cargo.toml Cargo.lock
@git commit -m "chore: bump version to $(VERSION)"
@git tag "v$(VERSION)"
@echo ""
@echo "Version bumped to $(VERSION) and tagged v$(VERSION)."
@echo "Run 'git push && git push --tags' to trigger the release."