From 39b7ccb9646b7c1480ed379d0abba19fc1871db2 Mon Sep 17 00:00:00 2001 From: Nick Art <100365428+NicK4rT@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:30:35 -0500 Subject: [PATCH] Update release-render-pipeline.yml --- .github/workflows/release-render-pipeline.yml | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release-render-pipeline.yml b/.github/workflows/release-render-pipeline.yml index 7269518..e5c24a0 100644 --- a/.github/workflows/release-render-pipeline.yml +++ b/.github/workflows/release-render-pipeline.yml @@ -69,13 +69,6 @@ jobs: # Combine the changed and new files all_changed_files=$(echo "$changed_files $new_files" | tr ' ' '\n') - # Read the current version dictionary from config.py - python3 -c "from software.release.config import version; import json; print(version)" > current_version.json - - # Debugging: Check the content of current_version.json - echo "Current version data:" - cat current_version.json - # Process each file in file_list.txt while read file; do # Extract the base file name from the full path @@ -83,25 +76,22 @@ jobs: # Check if the file has been modified (either staged or new file) if echo "$all_changed_files" | grep -q "$base_file"; then - # Check if the file exists in the version dictionary - if grep -q "$base_file" current_version.json; then - # Get the current version number - current_version=$(python3 -c "from software.release.config import version; print(version.get('$base_file', 0))") - - # Debugging: Check current version - echo "Current version for $base_file: $current_version" + # Check if the file exists in the config.py + if grep -q "$base_file" software/release/config.py; then + # Get the current version number using sed + current_version=$(sed -n "s/^.*'$base_file': \([0-9]*\),.*$/\1/p" software/release/config.py) # Increment the version number by 1 new_version=$((current_version + 1)) - python3 -c "from software.release.config import version; import json; version['$base_file'] = $new_version; \ - with open('software/release/config.py', 'w') as f: json.dump(version, f, indent=4)" + + # Update the version using sed + sed -i "s/^.*'$base_file': $current_version,.*$/'$base_file': $new_version,/g" software/release/config.py # Debugging: Print the file name and updated version echo "Updated $base_file version from $current_version to $new_version" else # Add the file with version 1 if it's not already in the dictionary - python3 -c "from software.release.config import version; import json; version['$base_file'] = 1; \ - with open('software/release/config.py', 'w') as f: json.dump(version, f, indent=4)" + sed -i "/^version = {/a \ \ \ \ '$base_file': 1," software/release/config.py # Debugging: Print that the file was added with version 1 echo "Added $base_file with version 1"