Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Commit

Permalink
Split documentation build into separate step
Browse files Browse the repository at this point in the history
  • Loading branch information
carver committed Sep 12, 2019
1 parent 5f8a4e7 commit d569b01
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,20 @@ package: clean
python setup.py sdist bdist_wheel
python scripts/release/test_package.py

release: clean
CURRENT_SIGN_SETTING=$(git config commit.gpgSign)
git config commit.gpgSign true
notes:
# Let UPCOMING_VERSION be the version that is used for the current bump
$(eval UPCOMING_VERSION=$(shell bumpversion $(bump) --dry-run --list | grep new_version= | sed 's/new_version=//g'))
# Now generate the release notes to have them included in the release commit
towncrier --yes --version $(UPCOMING_VERSION)
# Before we bump the version, make sure that the towncrier-generated docs will build
make build-docs
# We need --allow-dirty because of the generated release_notes file but it is safe because the
# previous dry-run runs *without* --allow-dirty which ensures it's really just the release notes
# file that we are allowing to sit here dirty, waiting to get included in the release commit.
bumpversion --allow-dirty $(bump)
git commit -m "Compile release notes"

release: clean
./newsfragments/validate_files.py is-empty
CURRENT_SIGN_SETTING=$(git config commit.gpgSign)
git config commit.gpgSign true
bumpversion $(bump)
git push upstream && git push upstream --tags
python setup.py sdist bdist_wheel
twine upload dist/*
Expand All @@ -86,4 +87,4 @@ sdist: clean
ls -l dist

install-git-lfs:
apt-get install -y git-lfs
apt-get install -y git-lfs
14 changes: 13 additions & 1 deletion docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,22 @@ Before releasing a new version, build and test the package that will be released
# Preview the upcoming release notes
towncrier --draft
Compile the release notes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

After confirming that the release package looks okay, compile the release notes:

.. code:: sh
make notes bump=$$VERSION_PART_TO_BUMP$$
You may need to fix up any broken release note fragments before committing. Keep
running make build-docs until it passes, then commit and carry on.

Push the release to github & pypi
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

After confirming that the release package looks okay, release a new version:
After committing the compiled release notes, release a new version:

.. code:: sh
Expand Down
16 changes: 13 additions & 3 deletions newsfragments/validate_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import os
import pathlib
import sys

ALLOWED_EXTENSIONS = {
'.bugfix.rst',
Expand All @@ -22,11 +23,20 @@

THIS_DIR = pathlib.Path(__file__).parent

num_args = len(sys.argv) - 1
assert num_args in {0, 1}
if num_args == 1:
assert sys.argv[1] in ('is-empty', )

for fragment_file in THIS_DIR.iterdir():

if fragment_file.name in ALLOWED_FILES:
continue

full_extension = "".join(fragment_file.suffixes)
if full_extension not in ALLOWED_EXTENSIONS:
elif num_args == 0:
full_extension = "".join(fragment_file.suffixes)
if full_extension not in ALLOWED_EXTENSIONS:
raise Exception(f"Unexpected file: {fragment_file}")
elif sys.argv[1] == 'is-empty':
raise Exception(f"Unexpected file: {fragment_file}")
else:
raise RuntimeError("Strange: arguments {sys.argv} were validated, but not found")

0 comments on commit d569b01

Please sign in to comment.