Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve release changelogs #117

Merged
merged 6 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions .github/changelog-processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,38 @@
help="Should a release be made? Prints `1` or `0`.",
action="store_true"
)
group.add_argument(
"--print-changelog-from-last-release",
dest="changelog_last_release",
help="Print the changelog from the last release.",
action="store_true"
)

args = parser.parse_args()

with open(args.changelog, "r") as changelog:
lines = changelog.readlines()

changelog_last_release = ""
found_last_version = False

# Find the latest version
for line in lines:
if not line.startswith("## ["):
changelog_last_release += line
continue
elif not found_last_version:
changelog_last_release += line
found_last_version = True
version = line.strip().removeprefix("## [").split("]")[0]
else:
break
bkchr marked this conversation as resolved.
Show resolved Hide resolved

version = line.strip().removeprefix("## [").split("]")[0]
break

if args.print_latest_version:
if args.changelog_last_release:
print(changelog_last_release, end = "")
sys.exit(0)
elif args.print_latest_version:
print(version, end = "")
sys.exit(0)
elif args.should_release:
Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,21 @@ jobs:
CONTEXT=$(find . -name '*_srtool_output.json')
SRTOOL() { <$(<<<$CONTEXT head -n1) jq -r .$1; }
WASM() { <${JSON} jq -r ".runtimes.compressed.subwasm.$1"; }

# Copy the relevant parts of the changelog
.github/changelog-processor.py CHANGELOG.md --print-changelog-from-last-release > DRAFT
ggwpez marked this conversation as resolved.
Show resolved Hide resolved

tee -a DRAFT <<-EOF
EOF
tee -a DRAFT <CHANGELOG.md
tee -a DRAFT <<-EOF
## Runtime info
# Runtime info
*These runtimes were built with **$(SRTOOL rustc)** using **[$(SRTOOL gen)](https://github.com/paritytech/srtool)***

To replicate the build, use the following command:
```sh
srtool build \
--root --profile production \
--package CRATE_NAME --runtime-dir PATH_TO_CRATE \
--build-opts="--features=on-chain-release-build"
ggwpez marked this conversation as resolved.
Show resolved Hide resolved
```
EOF

for JSON in $(<<<$CONTEXT sort -sr)
Expand All @@ -127,7 +136,7 @@ jobs:

tee -a DRAFT <<-EOF

### $HEADING
## $HEADING
~~~
🏋️ Runtime Size: $(numfmt --to iec-i --format "%.2f" $(WASM size)) ($(WASM size) bytes)
🗜 Compressed: $(WASM 'compression | if .compressed then "Yes: \(1 - .size_compressed / .size_decompressed | . * 10000 | round / 100)%" else "No" end')
Expand Down
Loading