|
1 | 1 | # Makefile for l9format-python project |
2 | 2 |
|
| 3 | +VERSION := $(shell poetry version -s) |
| 4 | + |
3 | 5 | UNAME_S := $(shell uname -s) |
4 | 6 | ifeq ($(UNAME_S),Darwin) |
5 | 7 | SED := $(shell command -v gsed 2>/dev/null) |
@@ -98,8 +100,34 @@ check-trailing-whitespace: ## Check for trailing whitespaces in source files |
98 | 100 | install: ## Install dependencies with Poetry |
99 | 101 | poetry install |
100 | 102 |
|
| 103 | +.PHONY: build |
| 104 | +build: clean-dist ## Build package for distribution |
| 105 | + poetry build |
| 106 | + |
| 107 | +.PHONY: publish-dry-run |
| 108 | +publish-dry-run: build ## Dry-run: show what would be published |
| 109 | + @echo "Would publish l9format v$(VERSION)" |
| 110 | + @echo "Would create tag: v$(VERSION)" |
| 111 | + @echo "Would create GitHub release: v$(VERSION)" |
| 112 | + @echo "Package contents:" |
| 113 | + @ls -lh dist/ |
| 114 | + poetry publish --dry-run |
| 115 | + |
| 116 | +.PHONY: publish |
| 117 | +publish: build ## Publish to PyPI, tag and create GitHub release |
| 118 | + poetry publish |
| 119 | + git tag -a "v$(VERSION)" -m "Release v$(VERSION)" |
| 120 | + git push origin "v$(VERSION)" |
| 121 | + gh release create "v$(VERSION)" dist/* \ |
| 122 | + --title "v$(VERSION)" \ |
| 123 | + --notes "Release v$(VERSION)" |
| 124 | + |
| 125 | +.PHONY: clean-dist |
| 126 | +clean-dist: ## Clean distribution artifacts |
| 127 | + rm -rf dist/ |
| 128 | + |
101 | 129 | .PHONY: clean |
102 | | -clean: ## Clean build artifacts and caches |
| 130 | +clean: clean-dist ## Clean build artifacts and caches |
103 | 131 | rm -rf __pycache__ .pytest_cache .mypy_cache .ruff_cache |
104 | 132 | find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true |
105 | 133 | find . -type f -name "*.pyc" -delete 2>/dev/null || true |
0 commit comments