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.
|
||||
|
||||
<!-- 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
|
||||
|
|
|
@ -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 "$@"
|
||||
|
|
Loading…
Reference in New Issue