1616PACKAGE_FILE_NAME = ".package.json"
1717CODEGEN_FILE_NAME = ".codegen.json"
1818"""
19- This script tags the release of the SDKs using a combination of the GitHub API and Git commands.
20- It reads the local repository to determine necessary changes, updates changelogs, and creates tags.
19+ This script tags the release of the SDKs using a combination of the GitHub API and Git commands.
20+ It reads the local repository to determine necessary changes, updates changelogs, and creates tags.
2121
2222### How it Works:
2323- It does **not** modify the local repository directly.
@@ -99,8 +99,9 @@ class TagInfo:
9999 :package: package info.
100100 :version: release version for the package. Format: v<major>.<minor>.<pacth>
101101 :content: changes for the release, as they appear in the changelog.
102+ When written to CHANGELOG.md, the current date (YYYY-MM-DD) is automatically added.
102103
103- Example:
104+ Example (from NEXT_CHANGELOG.md) :
104105
105106 ## Release v0.56.0
106107
@@ -120,6 +121,8 @@ class TagInfo:
120121 ### API Changes
121122 * Add new Service
122123
124+ Note: When written to CHANGELOG.md, the header becomes: ## Release v0.56.0 (YYYY-MM-DD)
125+
123126 """
124127
125128 package : Package
@@ -275,7 +278,14 @@ def write_changelog(tag_info: TagInfo) -> None:
275278 changelog_path = os .path .join (os .getcwd (), tag_info .package .path , CHANGELOG_FILE_NAME )
276279 with open (changelog_path , "r" ) as f :
277280 changelog = f .read ()
278- updated_changelog = re .sub (r"(# Version changelog\n\n)" , f"\\ 1{ tag_info .content .strip ()} \n \n \n " , changelog )
281+
282+ # Add current date to the release header
283+ current_date = datetime .now (tz = timezone .utc ).strftime ("%Y-%m-%d" )
284+ content_with_date = re .sub (
285+ r"## Release v(\d+\.\d+\.\d+)" , rf"## Release v\1 ({ current_date } )" , tag_info .content .strip ()
286+ )
287+
288+ updated_changelog = re .sub (r"(# Version changelog\n\n)" , f"\\ 1{ content_with_date } \n \n \n " , changelog )
279289 gh .add_file (changelog_path , updated_changelog )
280290
281291
0 commit comments