-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05f348c
commit d3928a3
Showing
1 changed file
with
25 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,34 @@ | ||
# Makefile for Nebby GitHub Release and Tagging | ||
|
||
# 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 | ||
# Create a new tag | ||
git tag -a v$(VERSION) -m "Release version $(VERSION)" | ||
git push origin v$(VERSION) | ||
# Prompt for release notes | ||
@echo "Please enter release notes (press Ctrl+D when finished):" | ||
|
||
# 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" | ||
@echo "Release v$(VERSION) created and published on GitHub" | ||
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" |