Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 06bbb8e

Browse files
author
alrex
authored
minor fixes to release scripts (open-telemetry#1561)
1 parent 84b1b0c commit 06bbb8e

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

scripts/eachdist.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -533,13 +533,13 @@ def update_changelog(path, version, new_entry):
533533
try:
534534
with open(path) as changelog:
535535
text = changelog.read()
536-
if "## Version {}".format(version) in text:
536+
if "## [{}]".format(version) in text:
537537
raise AttributeError(
538538
"{} already contans version {}".format(path, version)
539539
)
540540
with open(path) as changelog:
541541
for line in changelog:
542-
if line.startswith("## Unreleased"):
542+
if line.startswith("## [Unreleased]"):
543543
unreleased_changes = False
544544
elif line.startswith("## "):
545545
break
@@ -552,26 +552,26 @@ def update_changelog(path, version, new_entry):
552552

553553
if unreleased_changes:
554554
print("updating: {}".format(path))
555-
text = re.sub("## Unreleased", new_entry, text)
555+
text = re.sub(r"## \[Unreleased\].*", new_entry, text)
556556
with open(path, "w") as changelog:
557557
changelog.write(text)
558558

559559

560-
def update_changelogs(targets, version):
561-
print("updating CHANGELOG")
560+
def update_changelogs(version):
562561
today = datetime.now().strftime("%Y-%m-%d")
563-
new_entry = "## Unreleased\n\n## Version {}\n\nReleased {}".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
565568
)
566569
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
575575

576576
if errors:
577577
sys.exit(1)
@@ -637,7 +637,7 @@ def release_args(args):
637637
version = args.version
638638
update_dependencies(targets, version)
639639
update_version_files(targets, version)
640-
update_changelogs(targets, version)
640+
update_changelogs(version)
641641

642642

643643
def test_args(args):

scripts/prepare_release.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,14 @@ git reset --hard origin/main
2828
git checkout -b release/${VERSION}
2929
git push origin release/${VERSION}
3030

31-
# create a temporary branch to create a PR for updated version and changelogs
32-
git checkout -b release/${VERSION}-auto
3331
./scripts/eachdist.py release --version ${VERSION}
3432
rc=$?
3533
if [ $rc != 0 ]; then
3634
echo "::set-output name=version_updated::0"
3735
exit 0
3836
fi
3937

40-
git add **/version.py **/setup.cfg **/CHANGELOG.md
38+
git add .
4139

4240
git commit -m "updating changelogs and version to ${VERSION}"
4341

0 commit comments

Comments
 (0)