@@ -25,22 +25,22 @@ def main():
2525
2626def bump_country_package (country , version ):
2727 time .sleep (60 * 5 )
28- # Update the version in the country package's setup.py
29- setup_py_path = f"setup.py "
30- with open (setup_py_path , "r" ) as f :
31- setup_py = f .read ()
28+ # Update the version in pyproject.toml
29+ pyproject_path = "pyproject.toml "
30+ with open (pyproject_path , "r" ) as f :
31+ pyproject = f .read ()
3232 # Find where it says {country}=={old version} and replace it with {country}=={new version}
3333 country_package_name = country .replace ("-" , "_" )
3434 package_version_regex = rf"{ country_package_name } ==(\d+\.\d+\.\d+)"
35- match = re .search (package_version_regex , setup_py )
35+ match = re .search (package_version_regex , pyproject )
3636
3737 # If the line was found, replace it with the new package version
3838 if match :
3939 new_line = f"{ country_package_name } =={ version } "
40- setup_py = setup_py .replace (match .group (0 ), new_line )
41- # Write setup_py to setup.py
42- with open (setup_py_path , "w" ) as f :
43- f .write (setup_py )
40+ pyproject = pyproject .replace (match .group (0 ), new_line )
41+ # Write updated pyproject.toml
42+ with open (pyproject_path , "w" ) as f :
43+ f .write (pyproject )
4444
4545 country_package_full_name = country .replace ("policyengine" , "PolicyEngine" ).replace (
4646 "-" , " "
@@ -50,13 +50,14 @@ def bump_country_package(country, version):
5050 country_id , country_id .upper ()
5151 )
5252
53- changelog_yaml = f"""- bump: patch\n changes:\n changed:\n - Update { country_package_full_name } to { version } \n """
54- # Write changelog_yaml to changelog.yaml
55- with open ("changelog_entry.yaml" , "w" ) as f :
56- f .write (changelog_yaml )
57-
58- # Commit the change and push to a branch
53+ # Define branch name (needed for changelog fragment filename)
5954 branch_name = f"bump-{ country } -to-{ version } "
55+
56+ # Create a changelog fragment in changelog.d/
57+ changelog_content = f"Update { country_package_full_name } to { version } .\n "
58+ fragment_path = f"changelog.d/{ branch_name } .changed.md"
59+ with open (fragment_path , "w" ) as f :
60+ f .write (changelog_content )
6061 # Checkout a new branch locally, add all the files, commit, and push using the GitHub CLI only
6162
6263 # First, create a new branch off master
0 commit comments