Skip to content

Commit

Permalink
Switch release script to twine
Browse files Browse the repository at this point in the history
  • Loading branch information
kislyuk committed Jan 22, 2019
1 parent 63bced3 commit 48173aa
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ release_patch:

release:
@if [[ -z $$TAG ]]; then echo "Use release_{major,minor,patch}"; exit 1; fi
@if ! type -P pandoc; then echo "Please install pandoc"; exit 1; fi
@if ! type -P sponge; then echo "Please install moreutils"; exit 1; fi
@if ! type -P http; then echo "Please install httpie"; exit 1; fi
@if ! type -P twine; then echo "Please install twine"; exit 1; fi
$(eval REMOTE=$(shell git remote get-url origin | perl -ne '/([^\/\:]+\/.+?)(\.git)?$$/; print $$1'))
$(eval GIT_USER=$(shell git config --get user.email))
$(eval GH_AUTH=$(shell if grep -q '@github.com' ~/.git-credentials; then echo $$(grep '@github.com' ~/.git-credentials | python3 -c 'import sys, urllib.parse as p; print(p.urlparse(sys.stdin.read()).netloc.split("@")[0])'); else echo $(GIT_USER); fi))
Expand All @@ -32,14 +36,15 @@ release:
git commit -m ${TAG}; \
git tag --sign --annotate --file $$TAG_MSG ${TAG}
git push --follow-tags
http --auth ${GH_AUTH} ${RELEASES_API} tag_name=${TAG} name=${TAG} \
http --check-status --auth ${GH_AUTH} ${RELEASES_API} tag_name=${TAG} name=${TAG} \
body="$$(git tag --list ${TAG} -n99 | perl -pe 's/^\S+\s*// if $$. == 1' | sed 's/^\s\s\s\s//')"
$(MAKE) install
http --auth ${GH_AUTH} POST ${UPLOADS_API}/$$(http --auth ${GH_AUTH} ${RELEASES_API}/latest | jq .id)/assets \
http --check-status --auth ${GH_AUTH} POST ${UPLOADS_API}/$$(http --auth ${GH_AUTH} ${RELEASES_API}/latest | jq .id)/assets \
name==$$(basename dist/*.whl) label=="Python Wheel" < dist/*.whl
$(MAKE) pypi_release

pypi_release:
python setup.py sdist bdist_wheel upload --sign
python setup.py sdist bdist_wheel
twine upload dist/*.tar.gz dist/*.whl --sign --verbose

.PHONY: release

0 comments on commit 48173aa

Please sign in to comment.