Skip to content

Commit

Permalink
makefile change
Browse files Browse the repository at this point in the history
  • Loading branch information
CHRISCARLON committed Sep 18, 2024
1 parent 05f348c commit d3928a3
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions makefile
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"

0 comments on commit d3928a3

Please sign in to comment.