Skip to content

Commit f26dd81

Browse files
committed
Updating example.rst.mako and check_latest_release.yml file
1 parent 1dbdc05 commit f26dd81

File tree

2 files changed

+26
-19
lines changed

2 files changed

+26
-19
lines changed

.github/workflows/check_latest_release.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,21 @@ jobs:
2525
- x64
2626
- rdss-nimibot-win-10-py32
2727
timeout-minutes: 30
28-
strategy:
29-
matrix:
30-
module_name:
31-
- nidigital
32-
- nitclk
33-
- nifgen
34-
- nidcpower
35-
- nidmm
36-
- niscope
37-
- nimodinst
38-
- nise
39-
- niswitch
4028
steps:
4129
- name: checkout repository
4230
uses: actions/checkout@v3
43-
# NOTE: we don't upload test coverage for this
31+
32+
- name: Extract module name and version from release tag
33+
id: extract_tag
34+
run: |
35+
# Extract module name and version from the release tag
36+
# Assuming the tag format is <module_name>-<version>, e.g., nidigital-1.4.0
37+
TAG="${{ github.event_name == 'workflow_dispatch' && inputs.release_tag || github.event.release.tag_name }}"
38+
MODULE_NAME=$(echo "$TAG" | cut -d'-' -f1)
39+
MODULE_VERSION=$(echo "$TAG" | cut -d'-' -f2-)
40+
4441
- name: run examples using PyPI uploads
4542
uses: ./.github/actions/run_examples_using_pypi_uploads
4643
with:
47-
module_name: ${{ matrix.module_name }}
48-
module_version: ${{ github.event_name == 'workflow_dispatch' && inputs.release_tag || github.event.release.tag_name }}
44+
module_name: ${{ env.module_name }}
45+
module_version: ${{ env.module_version }}

build/templates/examples.rst.mako

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,23 @@
2727
2828
with open(f'./src/{module_name}/LATEST_RELEASE') as vf:
2929
latest_release_version = vf.read().strip()
30-
released_zip_url = 'https://github.com/ni/nimi-python/releases/download/{}/{}_examples.zip'.format(latest_release_version, module_name)
31-
32-
example_url_base = 'https://github.com/ni/nimi-python/blob/'
3330
3431
from packaging.version import Version
3532
v = Version(module_version)
3633
34+
# Check if the module name and version match the old tag formatting criteria
35+
use_old_tag_format = (
36+
module_name in ['nidcpower', 'nidigital', 'nidmm', 'nifake', 'niswitch', 'nimodinst', 'nifgen', 'niscope', 'nise', 'nitclk']
37+
and v.major <= 1 and v.minor <= 4 and v.micro <= 9
38+
)
39+
40+
if use_old_tag_format:
41+
released_zip_url = 'https://github.com/ni/nimi-python/releases/download/v{}/{}_examples.zip'.format(latest_release_version, module_name)
42+
else:
43+
released_zip_url = 'https://github.com/ni/nimi-python/releases/download/{}-{}/{}_examples.zip'.format(module_name, latest_release_version, module_name)
44+
45+
example_url_base = 'https://github.com/ni/nimi-python/blob/'
46+
3747
if v.dev is None and v.pre is None:
3848
examples_zip_url_text = '`You can download all {} examples here <{}>`_'.format(module_name, released_zip_url)
3949
example_url_base += latest_release_version
@@ -54,4 +64,4 @@ ${helper.get_rst_header_snippet(os.path.basename(e), '-')}
5464
:encoding: utf8
5565
:caption: `(${os.path.basename(e)}) <${example_url_base}/${e.replace('\\', '/')}>`_
5666

57-
% endfor
67+
% endfor

0 commit comments

Comments
 (0)