1
1
# Makefile for cog work.
2
2
3
+ # A command to get the current version from cogapp.py
4
+ VERSION := $$(python -c "import cogapp.cogapp; print(cogapp.cogapp.__version__ ) ")
5
+
3
6
.PHONY : help clean sterile test
4
7
5
8
help : # # Show this help.
@@ -49,7 +52,7 @@ dochtml: ## Build local docs.
49
52
50
53
# Release
51
54
52
- .PHONY : dist pypi testpypi check_release _check_manifest
55
+ .PHONY : dist pypi testpypi tag release check_release _check_credentials _check_manifest _check_tree _check_version
53
56
54
57
dist : # # Build distribution artifacts.
55
58
python -m build
@@ -61,8 +64,33 @@ pypi: ## Upload distributions to PyPI.
61
64
testpypi : # # Upload distributions to test PyPI
62
65
twine upload --verbose --repository testpypi --password $$ TWINE_TEST_PASSWORD dist/*
63
66
64
- check_release : _check_manifest # # Check that we are ready for a release
67
+ tag : # # Make a git tag with the version number
68
+ git tag -s -m " Version $( VERSION) " v$(VERSION )
69
+ git push --all
70
+
71
+ release : _check_credentials clean check_release dist pypi tag # # Do all the steps for a release
72
+ @echo " Release $( VERSION) complete!"
73
+
74
+ check_release : _check_manifest _check_tree _check_version # # Check that we are ready for a release
65
75
@echo " Release checks passed"
66
76
77
+ _check_credentials :
78
+ @if [[ -z " $$ TWINE_PASSWORD" ]]; then \
79
+ echo ' Missing TWINE_PASSWORD' ; \
80
+ exit 1; \
81
+ fi
82
+
67
83
_check_manifest :
68
84
python -m check_manifest
85
+
86
+ _check_tree :
87
+ @if [[ -n $$ (git status --porcelain) ]]; then \
88
+ echo ' There are modified files! Did you forget to check them in?' ; \
89
+ exit 1; \
90
+ fi
91
+
92
+ _check_version :
93
+ @if git tag | grep -q -w v$(VERSION ) ; then \
94
+ echo ' A git tag for this version exists! Did you forget to bump the version?' ; \
95
+ exit 1; \
96
+ fi
0 commit comments