-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (52 loc) · 1.68 KB
/
Makefile
File metadata and controls
60 lines (52 loc) · 1.68 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
.PHONY: git-tag git-untag git-edit version test-mcp
# Extract version from Cargo.toml
VERSION := $(shell grep '^version' Cargo.toml | head -1 | cut -d'"' -f2)
TAG := v$(VERSION)
# Show current version
version:
@echo "Current version: $(VERSION)"
@echo "Tag: $(TAG)"
git-release: git-untag git-edit git-push-force git-tag
git-push-force:
git push -f
# Create and push a git tag based on Cargo.toml version
git-tag: version
@echo "Creating tag $(TAG)..."
@if git rev-parse "$(TAG)" >/dev/null 2>&1; then \
echo "Error: Tag $(TAG) already exists"; \
exit 1; \
fi
git tag -a "$(TAG)" -m "Release $(TAG)"
git push origin "$(TAG)"
@echo "Successfully created and pushed tag $(TAG)"
# Delete a git tag locally and from remote based on Cargo.toml version
git-untag: version
@echo "Deleting tag $(TAG)..."
@if ! git rev-parse "$(TAG)" >/dev/null 2>&1; then \
echo "Warning: Tag $(TAG) does not exist locally"; \
else \
git tag -d "$(TAG)"; \
echo "Deleted local tag $(TAG)"; \
fi
@if git ls-remote --tags origin | grep -q "refs/tags/$(TAG)"; then \
git push origin ":refs/tags/$(TAG)"; \
echo "Deleted remote tag $(TAG)"; \
else \
echo "Warning: Tag $(TAG) does not exist on remote"; \
fi
# Amend the last commit to include currently staged files
git-edit:
@echo "Amending last commit with staged changes..."
@if [ -z "$$(git diff --cached --name-only)" ]; then \
echo "Warning: No staged files to amend"; \
echo "Current status:"; \
git status --short; \
else \
echo "Staged files to be added to last commit:"; \
git diff --cached --name-only; \
git commit --amend --no-edit; \
echo "Successfully amended last commit"; \
fi
# Run MCP tests
test-mcp:
$(MAKE) -C test/mcp