diff --git a/resources/release-notes.md b/resources/release-notes.md index 3456ff0d..fbbb22ec 100644 --- a/resources/release-notes.md +++ b/resources/release-notes.md @@ -25,7 +25,7 @@ For OS requirements, please refer to the relevant section in the [README]. Please go to [changelog.md] for detailed description of all the changes. -**Commits since last version**: https://github.com/lite-xl/lite-xl/compare/v2.1.3...${RELEASE_TAG} +**Commits since last version**: https://github.com/lite-xl/lite-xl/compare/${LAST_RELEASE_TAG}...${RELEASE_TAG} [win32-setup]: https://github.com/lite-xl/lite-xl/releases/download/${RELEASE_TAG}/LiteXL-${RELEASE_TAG}-addons-i686-setup.exe diff --git a/scripts/generate-release-notes.sh b/scripts/generate-release-notes.sh index da98a63b..bbb42da4 100755 --- a/scripts/generate-release-notes.sh +++ b/scripts/generate-release-notes.sh @@ -13,7 +13,7 @@ show_help() { echo echo "Available options:" echo - echo "--version Use this version instead of git tags or GitHub outputs." + echo "--version The current version used to generate release notes." echo "--debug Debug this script." echo "--help Show this message." echo @@ -21,6 +21,7 @@ show_help() { main() { local version + local last_version for i in "$@"; do case $i in @@ -49,21 +50,20 @@ main() { fi if [[ -z "$version" ]]; then - if [[ "$GITHUB_REF" == "refs/tags/"* ]]; then - version="${GITHUB_REF##*/}" - else - version="$(git describe --tags $(git rev-list --tags --max-count=1))" - if [[ $? -ne 0 ]]; then version=""; fi - fi + echo "error: a version must be provided" + exit 1 fi - if [[ -z "$version" ]]; then - echo "error: cannot get latest git tag" + # use gh cli to get the last version + read -r last_version < <(gh release list --exclude-pre-releases --limit 1 | awk 'BEGIN {FS="\t"}; {print $3}') + if [[ -z "$last_version" ]]; then + echo "error: cannot get last release git tag" exit 1 fi export RELEASE_TAG="$version" - envsubst '$RELEASE_TAG' > release-notes.md < resources/release-notes.md + export LAST_RELEASE_TAG="$last_version" + envsubst '$RELEASE_TAG:$LAST_RELEASE_TAG' > release-notes.md < resources/release-notes.md } main "$@"