Skip to content

Commit

Permalink
Update release script to publish github pages docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kislyuk committed Oct 16, 2020
1 parent 480770f commit f2eb207
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ init_docs: test_deps
cd docs; sphinx-quickstart

docs: test_deps
$(MAKE) -C docs html
sphinx-build docs docs/html

install: clean
python ./setup.py bdist_wheel
Expand Down
24 changes: 18 additions & 6 deletions common.mk
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
SHELL=/bin/bash -eo pipefail

release_major:
release-major:
$(eval export TAG=$(shell git describe --tags --match 'v*.*.*' | perl -ne '/^v(\d+)\.(\d+)\.(\d+)/; print "v@{[$$1+1]}.0.0"'))
$(MAKE) release

release_minor:
release-minor:
$(eval export TAG=$(shell git describe --tags --match 'v*.*.*' | perl -ne '/^v(\d+)\.(\d+)\.(\d+)/; print "v$$1.@{[$$2+1]}.0"'))
$(MAKE) release

release_patch:
release-patch:
$(eval export TAG=$(shell git describe --tags --match 'v*.*.*' | perl -ne '/^v(\d+)\.(\d+)\.(\d+)/; print "v$$1.$$2.@{[$$3+1]}"'))
$(MAKE) release

release:
@if [[ -z $$TAG ]]; then echo "Use release_{major,minor,patch}"; exit 1; fi
@if ! git diff --cached --exit-code; then echo "Commit staged files before proceeding"; exit 1; fi
@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
Expand Down Expand Up @@ -41,10 +42,21 @@ release:
$(MAKE) install
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
$(MAKE) release-pypi
$(MAKE) release-docs

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

release-docs:
$(MAKE) docs
-git branch -D gh-pages
git checkout -B gh-pages-stage
touch docs/html/.nojekyll
git add --force docs/html
git commit -m "Docs for ${TAG}"
git push --force origin $$(git subtree split --prefix docs/html --branch gh-pages):refs/heads/gh-pages
git checkout -

.PHONY: release

0 comments on commit f2eb207

Please sign in to comment.