Skip to content

Commit 2ce3743

Browse files
committed
Makefile: add publish, dry-run, tag, and release targets
1 parent 7b800c9 commit 2ce3743

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

Makefile

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Makefile for l9format-python project
22

3+
VERSION := $(shell poetry version -s)
4+
35
UNAME_S := $(shell uname -s)
46
ifeq ($(UNAME_S),Darwin)
57
SED := $(shell command -v gsed 2>/dev/null)
@@ -94,8 +96,34 @@ check-trailing-whitespace: ## Check for trailing whitespaces in source files
9496
install: ## Install dependencies with Poetry
9597
poetry install
9698

99+
.PHONY: build
100+
build: clean-dist ## Build package for distribution
101+
poetry build
102+
103+
.PHONY: publish-dry-run
104+
publish-dry-run: build ## Dry-run: show what would be published
105+
@echo "Would publish l9format v$(VERSION)"
106+
@echo "Would create tag: v$(VERSION)"
107+
@echo "Would create GitHub release: v$(VERSION)"
108+
@echo "Package contents:"
109+
@ls -lh dist/
110+
poetry publish --dry-run
111+
112+
.PHONY: publish
113+
publish: build ## Publish to PyPI, tag and create GitHub release
114+
poetry publish
115+
git tag -a "v$(VERSION)" -m "Release v$(VERSION)"
116+
git push origin "v$(VERSION)"
117+
gh release create "v$(VERSION)" dist/* \
118+
--title "v$(VERSION)" \
119+
--notes "Release v$(VERSION)"
120+
121+
.PHONY: clean-dist
122+
clean-dist: ## Clean distribution artifacts
123+
rm -rf dist/
124+
97125
.PHONY: clean
98-
clean: ## Clean build artifacts and caches
126+
clean: clean-dist ## Clean build artifacts and caches
99127
rm -rf __pycache__ .pytest_cache .mypy_cache .ruff_cache
100128
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
101129
find . -type f -name "*.pyc" -delete 2>/dev/null || true

0 commit comments

Comments
 (0)