diff --git a/.github/resources/changelog-index-generator.py b/.github/resources/changelog-index-generator.py index 7ad1bddfad..a92589ca36 100644 --- a/.github/resources/changelog-index-generator.py +++ b/.github/resources/changelog-index-generator.py @@ -1,45 +1,57 @@ import os - -# pip install packaging from packaging.version import parse as parse_version +from datetime import datetime +import git BREAK = "\n" # folder path dir_path = r'./changelog-versions' -# list to store files -changelog_files_extension = [] +# list to store files with creation dates and first commit dates +changelog_files_with_dates = [] # Iterate directory for path in os.listdir(dir_path): # check if current path is a file if os.path.isfile(os.path.join(dir_path, path)): - changelog_files_extension.append(path) - if path == ".DS_Store": - changelog_files_extension.remove(path) -# print(changelog_files_extension) + file_name = path.replace('.md', '') # Remove extension + file_path = os.path.join(dir_path, path) + + # Get first commit date using gitpython + repo = git.Repo(search_parent_directories=True) + first_commit_date = repo.git.log('--format=%aI', '--', file_path).splitlines()[-1] -# Remove extension from files -changelog_files = list( - map(lambda x: x.replace('.md', ''), changelog_files_extension)) -# print(changelog_files) + # Format the date + first_commit_date = datetime.fromisoformat(first_commit_date).strftime('%Y-%m-%d') + + changelog_files_with_dates.append((file_name, first_commit_date)) # Sort files by version -changelog_files_sorted = sorted(changelog_files, reverse=True, key=lambda x: [int( - i) if i.isdigit() else i for i in x.split('.')]) -print(changelog_files_sorted) +changelog_files_with_dates_sorted = sorted(changelog_files_with_dates, reverse=True, key=lambda x: [int( + i) if i.isdigit() else i for i in x[0].split('.')]) +# Generate list of versions in HTML table format changelog_version = "" -# Generate list of versions in markdown format -for item in changelog_files_sorted: - # print(item) - # If version is major, then use ## for make this version as a "large" title - major = "## " if item.endswith('.0.0') else "" - changelog_version += major + "[" + item + "]" + \ - "(" + "changelog-versions/" + item + ".md" + ")" + BREAK + BREAK - # print(changelog_version) +# Agregar el encabezado de la tabla en HTML +changelog_version += "\n" +changelog_version += "\n" + +for item, first_commit_date in changelog_files_with_dates_sorted: + if item.endswith('.0.0'): + major = f"{item}" + else: + major = f"{item}" + + # Agregar una fila de la tabla en HTML para cada versión + changelog_version += f"\n" + +# Cerrar la tabla HTML +changelog_version += "
VersionRelease date
{major}{first_commit_date}
\n" + +# Agregar saltos de línea según tu BREAK +changelog_version += BREAK + BREAK # Empty line print() @@ -47,7 +59,6 @@ # Draw markdown file file_content = "# Figma Changelog" + BREAK + BREAK + changelog_version + "---" + BREAK + \ "[Changelog history →](https://paper.dropbox.com/doc/Changelog-Mistica-Design-System--BlDyPv0kWq8W502b64VVIPMsAQ-il1pWXaGur0Nm88P831X2)" + BREAK -print(file_content) # Save file output_file_path = "./CHANGELOG.md" diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c1b1b4adc..6670eadd99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,72 +1,43 @@ # Figma Changelog -[11.1.0](changelog-versions/11.1.0.md) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VersionRelease date
11.1.02023-10-16
11.0.02023-10-10
10.0.02023-10-02
9.3.02023-09-11
9.2.02023-09-01
9.1.02023-07-31
9.0.02023-07-04
8.4.02023-06-12
8.3.02023-05-26
8.2.02023-05-16
8.1.02023-04-27
8.0.02023-04-10
7.3.02023-02-27
7.2.02023-02-10
7.1.12023-01-30
7.1.02023-01-27
7.0.22023-01-20
7.0.12023-01-13
7.0.02023-01-10
6.3.02022-11-25
6.2.02022-11-14
6.1.02022-10-31
6.0.02022-09-30
5.4.02022-08-26
5.3.02022-08-12
5.2.22022-08-04
5.2.12022-08-01
5.2.02022-07-29
5.1.02022-07-14
5.0.02022-07-10
4.11.02022-07-10
4.10.02022-07-10
4.9.02022-07-10
4.8.02022-07-10
-## [11.0.0](changelog-versions/11.0.0.md) - -## [10.0.0](changelog-versions/10.0.0.md) - -[9.3.0](changelog-versions/9.3.0.md) - -[9.2.0](changelog-versions/9.2.0.md) - -[9.1.0](changelog-versions/9.1.0.md) - -## [9.0.0](changelog-versions/9.0.0.md) - -[8.4.0](changelog-versions/8.4.0.md) - -[8.3.0](changelog-versions/8.3.0.md) - -[8.2.0](changelog-versions/8.2.0.md) - -[8.1.0](changelog-versions/8.1.0.md) - -## [8.0.0](changelog-versions/8.0.0.md) - -[7.3.0](changelog-versions/7.3.0.md) - -[7.2.0](changelog-versions/7.2.0.md) - -[7.1.1](changelog-versions/7.1.1.md) - -[7.1.0](changelog-versions/7.1.0.md) - -[7.0.2](changelog-versions/7.0.2.md) - -[7.0.1](changelog-versions/7.0.1.md) - -## [7.0.0](changelog-versions/7.0.0.md) - -[6.3.0](changelog-versions/6.3.0.md) - -[6.2.0](changelog-versions/6.2.0.md) - -[6.1.0](changelog-versions/6.1.0.md) - -## [6.0.0](changelog-versions/6.0.0.md) - -[5.4.0](changelog-versions/5.4.0.md) - -[5.3.0](changelog-versions/5.3.0.md) - -[5.2.2](changelog-versions/5.2.2.md) - -[5.2.1](changelog-versions/5.2.1.md) - -[5.2.0](changelog-versions/5.2.0.md) - -[5.1.0](changelog-versions/5.1.0.md) - -## [5.0.0](changelog-versions/5.0.0.md) - -[4.11.0](changelog-versions/4.11.0.md) - -[4.10.0](changelog-versions/4.10.0.md) - -[4.9.0](changelog-versions/4.9.0.md) - -[4.8.0](changelog-versions/4.8.0.md) --- [Changelog history →](https://paper.dropbox.com/doc/Changelog-Mistica-Design-System--BlDyPv0kWq8W502b64VVIPMsAQ-il1pWXaGur0Nm88P831X2)