resources,scripts: use gh cli to fetch the correct release tags
This commit is contained in:
parent
9dd4b81b39
commit
0129e9330f
|
@ -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.
|
Please go to [changelog.md] for detailed description of all the changes.
|
||||||
|
|
||||||
<!-- UPDATE THIS! -->
|
<!-- 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
|
[win32-setup]: https://github.com/lite-xl/lite-xl/releases/download/${RELEASE_TAG}/LiteXL-${RELEASE_TAG}-addons-i686-setup.exe
|
||||||
|
|
|
@ -13,7 +13,7 @@ show_help() {
|
||||||
echo
|
echo
|
||||||
echo "Available options:"
|
echo "Available options:"
|
||||||
echo
|
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 "--debug Debug this script."
|
||||||
echo "--help Show this message."
|
echo "--help Show this message."
|
||||||
echo
|
echo
|
||||||
|
@ -21,6 +21,7 @@ show_help() {
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
local version
|
local version
|
||||||
|
local last_version
|
||||||
|
|
||||||
for i in "$@"; do
|
for i in "$@"; do
|
||||||
case $i in
|
case $i in
|
||||||
|
@ -49,21 +50,20 @@ main() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$version" ]]; then
|
if [[ -z "$version" ]]; then
|
||||||
if [[ "$GITHUB_REF" == "refs/tags/"* ]]; then
|
echo "error: a version must be provided"
|
||||||
version="${GITHUB_REF##*/}"
|
exit 1
|
||||||
else
|
|
||||||
version="$(git describe --tags $(git rev-list --tags --max-count=1))"
|
|
||||||
if [[ $? -ne 0 ]]; then version=""; fi
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$version" ]]; then
|
# use gh cli to get the last version
|
||||||
echo "error: cannot get latest git tag"
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export RELEASE_TAG="$version"
|
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 "$@"
|
main "$@"
|
||||||
|
|
Loading…
Reference in New Issue