resources,scripts: use gh cli to fetch the correct release tags

This commit is contained in:
takase1121
2024-06-29 22:46:14 +08:00
parent 4bfcd0d16e
commit 474d696c84
2 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -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.
<!-- UPDATE THIS! -->
**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
+10 -10
View File
@@ -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 "$@"