From fb6a03287242f50904540c9e71a991d6cea3a209 Mon Sep 17 00:00:00 2001 From: Larvan2 <78135608+Larvan2@users.noreply.github.com> Date: Sat, 3 Jun 2023 10:25:00 +0000 Subject: [PATCH] chore: genReleaseNote support verrsion range This commit updates the release script to handle the input version range provided via command line options. Now, you can specify the version range using the '-v' option, such as '-v v1.14.1...v1.14.2', and the script will generate the release notes based on the specified range. The script parses the command line options, extracts the version range, and uses it in the 'git log' commands to capture the relevant commits. The output is then organized into different sections, including 'What's Changed', 'BUG & Fix', and 'Maintenance', along with the full changelog link. This enhancement improves the flexibility and usability of the release script, allowing users to generate release notes for specific version ranges easily. Co-authored-by: ChatGPT --- .github/genReleaseNote.sh | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/.github/genReleaseNote.sh b/.github/genReleaseNote.sh index e3b35e76..2c2afcc6 100755 --- a/.github/genReleaseNote.sh +++ b/.github/genReleaseNote.sh @@ -1 +1,32 @@ -git log --pretty=format:"* %s by @%an" v1.14.x..v1.14.y | sort -f | uniq > release.md +#!/bin/bash + +while getopts "v:" opt; do + case $opt in + v) + version_range=$OPTARG + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + exit 1 + ;; + esac +done + +if [ -z "$version_range" ]; then + echo "Please provide the version range using -v option. Example: ./genReleashNote.sh -v v1.14.1...v1.14.2" + exit 1 +fi + +echo "## What's Changed" > release.md +git log --pretty=format:"* %s by @%an" --grep="^feat" $version_range | sort -f | uniq >> release.md +echo "" >> release.md + +echo "## BUG & Fix" >> release.md +git log --pretty=format:"* %s by @%an" --grep="^fix" $version_range | sort -f | uniq >> release.md +echo "" >> release.md + +echo "## Maintenance" >> release.md +git log --pretty=format:"* %s by @%an" --grep="^chore\|^docs" $version_range | sort -f | uniq >> release.md +echo "" >> release.md + +echo "**Full Changelog**: https://github.com/MetaCubeX/Clash.Meta/compare/$version_range" >> release.md