-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
34 lines (29 loc) · 1.07 KB
/
makefile
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
# Variables
VERSION := $(shell cargo pkgid | cut -d\# -f2 | cut -d: -f2)
FORCE_TAG := false
.PHONY: release
release:
@echo "Creating release $(VERSION)..."
@if [ -z "$(VERSION)" ]; then echo "Error: VERSION is not set"; exit 1; fi
# Check if tag exists
@if git rev-parse v$(VERSION) >/dev/null 2>&1; then \
if [ "$(FORCE_TAG)" = "true" ]; then \
echo "Updating tag v$(VERSION)..."; \
git tag -fa v$(VERSION) -m "Release version $(VERSION)"; \
git push -f origin v$(VERSION); \
else \
echo "Tag v$(VERSION) exists. Use FORCE_TAG=true to override."; \
exit 1; \
fi; \
else \
echo "Creating tag v$(VERSION)..."; \
git tag -a v$(VERSION) -m "Release version $(VERSION)"; \
git push origin v$(VERSION); \
fi
# Get release notes
@echo "Enter release notes (Ctrl+D to finish):"
@NOTES=$$(cat); \
gh release create v$(VERSION) --title "Nebby v$(VERSION)" --notes "$$NOTES" \
$$(if [ "$(FORCE_TAG)" = "true" ]; then echo "--target main"; fi) || \
{ echo "Error: Failed to create GitHub release."; exit 1; }
@echo "Release v$(VERSION) published on GitHub"