diff --git a/.github/workflows/check_latest_release.yml b/.github/workflows/check_latest_release.yml index b5b526190..ca0096429 100644 --- a/.github/workflows/check_latest_release.yml +++ b/.github/workflows/check_latest_release.yml @@ -31,14 +31,25 @@ jobs: - name: Extract module name and version from release tag id: extract_tag + shell: python run: | + import os + import json + # Extract module name and version from the release tag # Assuming the tag format is -, e.g., nidigital-1.4.0 - TAG="${{ github.event_name == 'workflow_dispatch' && inputs.release_tag || github.event.release.tag_name }}" - MODULE_NAME=$(echo "$TAG" | cut -d'-' -f1) - MODULE_VERSION=$(echo "$TAG" | cut -d'-' -f2-) - echo "module_name=$MODULE_NAME" >> "$GITHUB_OUTPUT" - echo "module_version=$MODULE_VERSION" >> "$GITHUB_OUTPUT" + with open(os.getenv("GITHUB_EVENT_PATH"), "r", encoding="utf-8") as event_file: + event = json.load(event_file) + if os.getenv("GITHUB_EVENT_NAME") == "workflow_dispatch": + tag = event["inputs"]["release_tag"] + else: + tag = event["release"]["tag_name"] + + assert tag.count("-") == 1, f"Invalid tag format: {tag}. Expected format: -" + module_name, module_version = tag.split("-") + with open(os.getenv("GITHUB_OUTPUT"), "a", encoding="utf-8") as output_file: + output_file.write(f"module_name={module_name}\n") + output_file.write(f"module_version={module_version}\n") # NOTE: we don't upload test coverage for this - name: run examples using PyPI uploads uses: ./.github/actions/run_examples_using_pypi_uploads