Skip to content

Commit 8aa1cf6

Browse files
authored
Merge pull request #20 from LeakIX/add-publish-targets
Makefile: add PyPI publish and release targets
2 parents 79979b5 + 2ce3743 commit 8aa1cf6

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)
@@ -98,8 +100,34 @@ check-trailing-whitespace: ## Check for trailing whitespaces in source files
98100
install: ## Install dependencies with Poetry
99101
poetry install
100102

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+
101129
.PHONY: clean
102-
clean: ## Clean build artifacts and caches
130+
clean: clean-dist ## Clean build artifacts and caches
103131
rm -rf __pycache__ .pytest_cache .mypy_cache .ruff_cache
104132
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
105133
find . -type f -name "*.pyc" -delete 2>/dev/null || true

0 commit comments

Comments
 (0)