Skip to content

Commit

Permalink
run script with params
Browse files Browse the repository at this point in the history
  • Loading branch information
andresmr committed Jan 2, 2024
1 parent 8333560 commit 13f4269
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
pip install toml
- name: Run Python script to update base branch version
run: python scripts/updateVersionName.py
run: python scripts/updateVersionName.py ${{ inputs.version_name }}

# override vName with new version
# - name: Create release branch
Expand Down
35 changes: 18 additions & 17 deletions scripts/updateVersionName.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
import toml
import os
# import os
import sys


file_path = os.path.join('gradle', 'libs.versions.toml')
# file_path = os.path.join('gradle', 'libs.versions.toml')
file_path = 'gradle/libs.versions.toml'

# Load the TOML file
with open(file_path, 'r') as file:
data = toml.load(file)

# print("Data dictionary:", data)

# Print the current value of vName
current_vName = data['versions']['vName']
print("Current value of vName:", current_vName)

# Update the desired value
data['versions']['vName'] = '2.10'

# Save the changes back to the file
with open(file_path, 'w') as file:
toml.dump(data, file)

# validate changes
with open(file_path, 'r') as file:
updated_data = toml.load(file)

print("New value of vName:", data['versions']['vName'])
# Check if a new version is provided as a command-line argument
if len(sys.argv) > 1:
new_vName_value = sys.argv[1]
# Update the 'vName' value in the data dictionary
data['versions']['vName'] = new_vName_value
# Print the updated value
print("Updated value of vName:", new_vName_value)

# Save the updated data back to the TOML file
with open(file_path, 'w') as file:
toml.dump(data, file)
print("File updated successfully!")
else:
print("No new version provided. To update the version, pass the new version as a command-line argument.")

0 comments on commit 13f4269

Please sign in to comment.