Browse Source

Add support for pre/post/dev releases (#351)

Vince Salvino 4 years ago
parent
commit
6686bb9074
2 changed files with 39 additions and 14 deletions
  1. 28 2
      coderedcms/__init__.py
  2. 11 12
      docs/contributing/index.rst

+ 28 - 2
coderedcms/__init__.py

@@ -1,4 +1,30 @@
-release = ["0", "19", "0"]
+"""
+Maintains version of coderedcms.
+4th element is for pre-releases. Leave blank for stable releases.
 
-__version__ = "{0}.{1}.{2}".format(release[0], release[1], release[2])
+    X.Y.ZaN   # Alpha release
+    X.Y.ZbN   # Beta release
+    X.Y.ZrcN  # Release Candidate
+    X.Y.Z     # Final release
+
+5th element is for dev/post releases. Leave blank for stable releases.
+
+    X.Y.Z.devN   # Development release
+    X.Y.Z.postN  # Post release (e.g. docs changes but no actual code changes)
+
+See: https://www.python.org/dev/peps/pep-0440/
+"""
+release = ["0", "19", "0", "rc1", ""]
+
+
+def _get_version() -> str:
+    v = "{0}.{1}.{2}".format(release[0], release[1], release[2])
+    if len(release) >= 4 and release[3]:
+        v = "{0}{1}".format(v, release[3])
+    if len(release) >= 5 and release[4]:
+        v = "{0}.{1}".format(v, release[4])
+    return v
+
+
+__version__ = _get_version()
 __shortversion__ = "{0}.{1}".format(release[0], release[1])

+ 11 - 12
docs/contributing/index.rst

@@ -295,6 +295,13 @@ Output will be in ``docs/_build/html/`` directory.
 Publishing a New Release
 ------------------------
 
+.. note::
+
+    For creating pre-releases, use the "rc" version specifier in
+    ``coderedcms/__init__.py``. When publishing a production release, leave this
+    blank. After a release is completed, increment the version and add the
+    "dev0" version specifier.
+
 First checkout the code/branch for release.
 
 Next build a pip package:
@@ -315,19 +322,11 @@ Finally build and update docs:
 
     $ ./ci/make-docs.ps1
 
-If updating docs for an existing minor version release:
+If updating docs for an existing major version release:
 
 #. Copy the contents of ``docs/_build/html/`` to the CodeRed docs server under
    the existing version directory.
 
-If this is a new major or minor version release:
-
-#. Create a new ``major.minor`` directory on the CodeRed docs server.
-#. Update the ``stable`` symbolic link to point to the new version directory.
-#. Add the new version to the ``versions.txt`` file on the docs server.
-#. Copy the contents of ``docs/_build/html/`` to the CodeRed docs server under
-   the new version directory.
-
-Note that we do not release separate documentation versions for maintenance
-releases. Update the existing minor version docs with release notes and other
-changes.
+Note that we do not release separate documentation versions for minor or
+maintenance releases. Update the existing major version docs with release notes
+and other changes.