@@ -533,13 +533,13 @@ def update_changelog(path, version, new_entry):
533
533
try :
534
534
with open (path ) as changelog :
535
535
text = changelog .read ()
536
- if "## Version {} " .format (version ) in text :
536
+ if "## [{}] " .format (version ) in text :
537
537
raise AttributeError (
538
538
"{} already contans version {}" .format (path , version )
539
539
)
540
540
with open (path ) as changelog :
541
541
for line in changelog :
542
- if line .startswith ("## Unreleased" ):
542
+ if line .startswith ("## [ Unreleased] " ):
543
543
unreleased_changes = False
544
544
elif line .startswith ("## " ):
545
545
break
@@ -552,26 +552,26 @@ def update_changelog(path, version, new_entry):
552
552
553
553
if unreleased_changes :
554
554
print ("updating: {}" .format (path ))
555
- text = re .sub ("## Unreleased" , new_entry , text )
555
+ text = re .sub (r "## \[ Unreleased\].* " , new_entry , text )
556
556
with open (path , "w" ) as changelog :
557
557
changelog .write (text )
558
558
559
559
560
- def update_changelogs (targets , version ):
561
- print ("updating CHANGELOG" )
560
+ def update_changelogs (version ):
562
561
today = datetime .now ().strftime ("%Y-%m-%d" )
563
- new_entry = "## Unreleased\n \n ## Version {}\n \n Released {}" .format (
564
- version , today
562
+ new_entry = """## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v{version}...HEAD)
563
+
564
+ ## [{version}](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v{version}) - {today}
565
+
566
+ """ .format (
567
+ version = version , today = today
565
568
)
566
569
errors = False
567
- for target in targets :
568
- try :
569
- update_changelog (
570
- "{}/CHANGELOG.md" .format (target ), version , new_entry
571
- )
572
- except Exception as err : # pylint: disable=broad-except
573
- print (str (err ))
574
- errors = True
570
+ try :
571
+ update_changelog ("./CHANGELOG.md" , version , new_entry )
572
+ except Exception as err : # pylint: disable=broad-except
573
+ print (str (err ))
574
+ errors = True
575
575
576
576
if errors :
577
577
sys .exit (1 )
@@ -637,7 +637,7 @@ def release_args(args):
637
637
version = args .version
638
638
update_dependencies (targets , version )
639
639
update_version_files (targets , version )
640
- update_changelogs (targets , version )
640
+ update_changelogs (version )
641
641
642
642
643
643
def test_args (args ):
0 commit comments