Skip to content

Commit 053cf49

Browse files
authored
Update check_latest_release.yml
Update shell script to use Python
1 parent a488e07 commit 053cf49

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

.github/workflows/check_latest_release.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,27 @@ jobs:
3131

3232
- name: Extract module name and version from release tag
3333
id: extract_tag
34+
shell: python
3435
run: |
36+
import os
37+
import json
38+
3539
# Extract module name and version from the release tag
3640
# 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-
echo "module_name=$MODULE_NAME" >> "$GITHUB_OUTPUT"
41-
echo "module_version=$MODULE_VERSION" >> "$GITHUB_OUTPUT"
41+
if os.getenv("GITHUB_EVENT_NAME") == "workflow_dispatch":
42+
tag = os.getenv("INPUT_release_tag")
43+
else:
44+
with open(os.getenv("GITHUB_EVENT_PATH"), "r") as event_file:
45+
event = json.load(event_file)
46+
tag = event["release"]["tag_name"]
47+
48+
module_name, module_version = tag.split("-")
49+
with open(os.getenv("GITHUB_OUTPUT"), "a") as output_file:
50+
output_file.write(f"module_name={module_name}\n")
51+
output_file.write(f"module_version={module_version}\n")
4252
# NOTE: we don't upload test coverage for this
4353
- name: run examples using PyPI uploads
4454
uses: ./.github/actions/run_examples_using_pypi_uploads
4555
with:
4656
module_name: ${{ steps.extract_tag.outputs.module_name }}
47-
module_version: ${{ steps.extract_tag.outputs.module_version }}
57+
module_version: ${{ steps.extract_tag.outputs.module_version }}

0 commit comments

Comments
 (0)