Skip to content

Commit

Permalink
Update release process to use correct version in examples documentati…
Browse files Browse the repository at this point in the history
…on (#1649)

* Fix the versioning in examples.rst.mako

* Update release script
  • Loading branch information
sbethur authored Aug 19, 2021
1 parent 45ee975 commit b70883d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
15 changes: 6 additions & 9 deletions build/templates/examples.rst.mako
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<%
import build.helper as helper
config = template_parameters['metadata'].config
module_name = config['module_name']
config = template_parameters['metadata'].config
module_name = config['module_name']
module_version = config['module_version']
import glob
import os
Expand All @@ -15,7 +16,7 @@
# 1) URL to zip file containing all examples and in cases like nidigital, support files
# 2) Code snippet and URL to example file in src folder, for each example
#
# - If there is dev or pre ('a', 'b', 'rc') in the VERSION file then:
# - If there is dev or pre ('a', 'b', 'rc') in module_version then:
# - it means code generator is being run during development
# - (1) will link to the zip file created during last release and the text will include "..for latest version.."
# - (2) will include current code snippet and URL will point to master branch
Expand All @@ -30,16 +31,12 @@
example_url_base = 'https://github.com/ni/nimi-python/blob/'
# We need to use the global version and not the module version since the release version will match the global version
# and may not match the module version
with open('./VERSION') as vf:
global_version = vf.read().strip()
from packaging.version import Version
v = Version(global_version)
v = Version(module_version)
if v.dev is None and v.pre is None:
examples_zip_url_text = '`You can download all {0} examples here <{1}>`_'.format(module_name, released_zip_url)
example_url_base += str(v)
example_url_base += latest_release_version
else:
examples_zip_url_text = '`You can download all {0} examples for latest version here <{1}>`_'.format(module_name, released_zip_url)
example_url_base += 'master'
Expand Down
2 changes: 1 addition & 1 deletion tools/build_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ def main():
* Change the "Unreleased" header to the version of the release
* Change [Unreleased] in TOC to the version of the release
* Commit to branch
* Update contents of LATEST_RELEASE with the version of the release being created.
* `python3 tools/build_release.py --update --release`
* This will update all the versions to remove any '.devN'
* Update contents of LATEST_RELEASE with the version of the release being created.
* Commit to branch
* `python3 tools/build_release.py --build`
* Clean and build to update generated files with new version
Expand Down

0 comments on commit b70883d

Please sign in to comment.