scripts/changelog.py: a few fixes (#5293)

This commit is contained in:
Igor 2022-11-08 16:44:28 +02:00 committed by GitHub
parent 3c8f68fed9
commit ec6a79af85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -3,9 +3,11 @@
import argparse import argparse
import collections
import subprocess import subprocess
GENERAL = "General" GENERAL = "General"
MULTINODE = "Multinode"
SATELLITE = "Satellite" SATELLITE = "Satellite"
STORAGENODE = "Storagenode" STORAGENODE = "Storagenode"
TEST = "Test" TEST = "Test"
@ -23,12 +25,14 @@ def git_ref_field(from_ref, to_ref):
def generate_changelog(commits): def generate_changelog(commits):
changelog = "# Changelog\n" changelog = "# Changelog\n"
section = {SATELLITE: [], STORAGENODE: [], TEST: [], UPLINK: [], GENERAL: []} section = {SATELLITE: [], MULTINODE: [], STORAGENODE: [], TEST: [], UPLINK: [], GENERAL: []}
# Sorting and populating the dictionary d with commit hash and message # Sorting and populating the dictionary d with commit hash and message
for commit in commits.splitlines(): for commit in commits.splitlines():
if TEST.lower() in commit[42:].split(":")[0]: if TEST.lower() in commit[42:].split(":")[0]:
section[TEST].append(generate_line(commit)) section[TEST].append(generate_line(commit))
elif MULTINODE.lower() in commit[42:].split(":")[0]:
section[MULTINODE].append(generate_line(commit))
elif STORAGENODE.lower() in commit[42:].split(":")[0]: elif STORAGENODE.lower() in commit[42:].split(":")[0]:
section[STORAGENODE].append(generate_line(commit)) section[STORAGENODE].append(generate_line(commit))
elif UPLINK.lower() in commit[42:].split(":")[0]: elif UPLINK.lower() in commit[42:].split(":")[0]:
@ -38,7 +42,7 @@ def generate_changelog(commits):
else: else:
section[GENERAL].append(generate_line(commit)) section[GENERAL].append(generate_line(commit))
for title in dict(sorted(section.items())): for title in collections.OrderedDict(sorted(section.items())):
if section[title]: if section[title]:
changelog += ('### {}\n'.format(title)) changelog += ('### {}\n'.format(title))
for line in section[title]: for line in section[title]:

View File

@ -16,8 +16,8 @@ FOLDER="${2-}"
echo "Drafting release" echo "Drafting release"
current_release_version=$(echo "$TAG" | cut -d '.' -f 1-2) current_release_version=$(echo "$TAG" | cut -d '.' -f 1-2)
previous_release_version=$(git describe --tags $(git rev-list --exclude='*rc*' --exclude="$current_release_version*" --tags --max-count=1)) previous_release_version=$(git describe --tags $(git rev-list --exclude='*rc*' --exclude=$current_release_version* --tags --max-count=1))
changelog=$(python changelog.py "$previous_release_version" "$TAG" 2>&1) changelog=$(python scripts/changelog.py "$previous_release_version" "$TAG" 2>&1)
github-release release --user storj --repo storj --tag "$TAG" --description "$changelog" --draft github-release release --user storj --repo storj --tag "$TAG" --description "$changelog" --draft
echo "Sleep 10 seconds in order to wait for release propagation" echo "Sleep 10 seconds in order to wait for release propagation"