Skip to content

Commit

Permalink
minor changes to nox tag process
Browse files Browse the repository at this point in the history
  • Loading branch information
rmorshea committed Feb 28, 2022
1 parent 856487c commit 78f33ff
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 64 deletions.
68 changes: 20 additions & 48 deletions docs/source/about/contributor-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -268,61 +268,33 @@ Where you can then navigate to http://localhost:5000..
Release Process
---------------

1. :ref:`Update version <Update Release Version>`
2. Create a release tag
3. Manually author a release in GitHub
Creating a release for IDOM involves two steps:

1. Tagging a version
2. Publishing a release

Update Release Version
......................

To simultaneously update the version for:

- Python packages
- Javascript packages
- The :ref:`changelog`

Run the following command:

.. code-block:: bash
nox -s update_version -- <new-version>
.. note::

The ``<new-version>`` must adhere to `SemVer <https://semver.org/>`__.

Then commit those changes:
To **tag a version** you'll run the following command:

.. code-block:: bash
git commit -m 'update version to <new-version>'
nox -s tag -- <the-new-version>
Which will update the version for:

Creating The Release
....................

The final release process involves two steps:

1. Creating a tag for the release
2. Authoring a release in GitHub

To create the release tag you can run the following command:

.. note::

To just create the tag without pushing, omit the trailing ``push`` argument

.. code-block:: bash
nox -s tag -- push
Last, you must create a `"Release"
<https://docs.github.com/en/github/administering-a-repository/releasing-projects-on-github/managing-releases-in-a-repository>`__
in GitHub. Because we pushed a tag using the command above, there should already be a
saved draft which needs a title and description. The title should simply be the version
(same as the tag), and the description should simply use GitHub's "Auto-generated
release notes".
- Python packages
- Javascript packages
- The changelog

You'll be then prompted to confirm the auto-generated updates before those changes will
be staged, committed, and pushed along with a new tag matching ``<the-new-version>``
which was specified earlier.

Lastly, to **publish a release** `create one in GitHub
<https://docs.github.com/en/github/administering-a-repository/releasing-projects-on-github/managing-releases-in-a-repository>`__.
Because we pushed a tag using the command above, there should already be a saved tag you
can target when authoring the release. The release needs a title and description. The
title should simply be the version (same as the tag), and the description should simply
use GitHub's "Auto-generated release notes".


Other Core Repositories
Expand Down
40 changes: 24 additions & 16 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,25 @@ def build_js(session: Session) -> None:
@nox.session
def tag(session: Session) -> None:
"""Create a new git tag"""
try:
session.run(
"git",
"diff",
"--cached",
"--exit-code",
silent=True,
external=True,
)
session.run(
"git",
"diff",
"--exit-code",
silent=True,
external=True,
)
except Exception:
session.error("Cannot create a tag - there are uncommited changes")

if len(session.posargs) > 1:
session.error("To many arguments")

Expand All @@ -312,17 +331,6 @@ def tag(session: Session) -> None:
# trigger npm install to update package-lock.json
session.install("-e", ".")

try:
session.run(
"git",
"diff",
"--cached",
"--exit-code",
external=True,
)
except Exception:
session.error("Cannot create a tag - there are uncommited changes")

version = get_version()
install_requirements_file(session, "make-release")
session.run("pysemver", "check", version)
Expand All @@ -339,15 +347,15 @@ def tag(session: Session) -> None:
)

if session.interactive:
response = input("confirm (yes/no): ").lower()
response = input("Confirm (yes/no): ").lower()
if response != "yes":
return None
session.error("Did not create tag")

# stage, commit, tag, and push version bump
session.run("git", "add", "--all")
session.run("git", "commit", "-m", repr(f"update version to {new_version}"))
session.run("git", "add", "--all", external=True)
session.run("git", "commit", "-m", repr(f"version {new_version}"), external=True)
session.run("git", "tag", version, external=True)
session.run("git", "push", "--tags", external=True)
session.run("git", "push", "origin", "main", "--tags", external=True)


@nox.session(reuse_venv=True)
Expand Down

0 comments on commit 78f33ff

Please sign in to comment.