Skip to content

Commit

Permalink
ci: generate new release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
zaloisio committed Jul 7, 2021
1 parent 6f6ca43 commit 8786875
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
15 changes: 3 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,10 @@ jobs:
sed -i "s/EXTENDNO=.*/EXTENDNO=${MINOR_VER}/g" release/src-rt/version.conf
fi
- run:
name: Generate changelog (only for tags)
name: Generate changelog
command: |
REGXP_TO_MATCH=.*gnuton.*
if [[ ${CIRCLE_TAG} =~ ${REGXP_TO_MATCH} ]]; then
CURRENT_TAG=${CIRCLE_TAG}
PREVIOUS_TAG=$(git tag --sort=-version:refname | grep -vE "snapshot|beta|alpha|${CIRCLE_TAG}" | grep ${REGXP_TO_MATCH} | head -n 1)
echo "Generating logs between the tags ${PREVIOUS_TAG} and ${CURRENT_TAG}"
echo "Changes from the latest stable gnuton build (${PREVIOUS_TAG}):" > "${CHANGELOG_FILE}"
git log ${PREVIOUS_TAG}...${CURRENT_TAG} --pretty=format:'* %s' --reverse | grep -vE 'Merge branch|ci:|Bump' >> "${CHANGELOG_FILE}" || echo "WARNING: The Changelog is empty!!"
cat "${CHANGELOG_FILE}"
else
echo "No changelog to generate. Changelog is generated only for tags matching ${REGXP_TO_MATCH}";
fi;
python tools/get-last-notes.py > "${CHANGELOG_FILE}"
cat "${CHANGELOG_FILE}"
- run:
name: Build firmware
shell: /bin/bash
Expand Down
30 changes: 30 additions & 0 deletions tools/get-last-notes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/python3
import re
from datetime import date

today=date.today()
CHANGELOG_FILE='Changelog-NG.txt'
MSG="""## GNUton's Asus Merlin changelog ##\n"""
latest_release = None
latest_changes = list()

with open(CHANGELOG_FILE) as f:

rx = re.compile('^(\d[^()]+)\s.*$')

for line in f:
release_search = rx.search(line)

if release_search:
if latest_release:
break
else:
latest_release = release_search.group(1)
else:
if latest_release:
latest_changes.append(line)

print(MSG)
print('Date: %s' % today.strftime("%B %d, %Y"))
print('Release: %s\n' % latest_release)
print("".join(latest_changes))

0 comments on commit 8786875

Please sign in to comment.