Skip to content

Commit

Permalink
Build a better Changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
kddejong committed Aug 21, 2024
1 parent 875182f commit 778b4b0
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/cd-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ jobs:
run: |
pip install -e .
scripts/release_schemas/generator.py
scripts/release_schemas/changelog.py --version ${{ github.ref_name }}
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/v1')
with:
name: Release ${{ github.ref_name }}
token: ${{ secrets.GH_PAT }}
generate_release_notes: true
body_path: ${{ github.workspace }}/build/CHANGELOG.txt
files: |
build/schemas-cfnlint.zip
build/schemas-draft7.zip
File renamed without changes.
34 changes: 34 additions & 0 deletions scripts/release/changelog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python
"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""

import argparse

# version = "v1.10.3"
from pathlib import Path

parser = argparse.ArgumentParser()
parser.add_argument("--version")
args = parser.parse_args()

with open("CHANGELOG.md", "r") as f:
text = f.read()

output = []

for line in text.splitlines():

if line.startswith("### "):
if args.version == line[3:].strip():
found = True
else:
break
else:
if found:
output.append(line)

build_dir = Path("build")
with open(build_dir / "CHANGELOG.md", "w") as f:
f.write("\n".join(output))
File renamed without changes.

0 comments on commit 778b4b0

Please sign in to comment.