diff --git a/tools/mkpkg/update_common_functions b/tools/mkpkg/update_common_functions index 7ae5a7d499..220ed3af21 100644 --- a/tools/mkpkg/update_common_functions +++ b/tools/mkpkg/update_common_functions @@ -67,17 +67,23 @@ resolve_hash_on_gh() { } resolve_tag_in_branch() { - local tag + local tag tags if [ -d "$1" ] ; then cd "$1" - if [ $# -eq 3 ] ; then - tag=$(git describe --abbrev=0 --tags --match "$3" origin/$2 2>/dev/null) - if [ -n "$tag" ] ; then - echo "$tag" - return - fi + tag=$(git describe --abbrev=0 --tags origin/$2 2>/dev/null) + if [ -z "${tag}" ]; then + return fi - git describe --abbrev=0 --tags origin/$2 2>/dev/null + tags=( $(git tag --points-at "${tag}" | sort -r -n) ) + if [ $# -eq 3 -a ${#tags[@]} -gt 1 ]; then + for tag in "${tags[@]}"; do + if [[ "${tag}" =~ $3 ]]; then + echo "$tag" + return + fi + done + fi + echo "${tags[0]}" fi } diff --git a/tools/mkpkg/update_retroplayer-addons b/tools/mkpkg/update_retroplayer-addons index a425f1ab0a..b758e4e253 100755 --- a/tools/mkpkg/update_retroplayer-addons +++ b/tools/mkpkg/update_retroplayer-addons @@ -132,7 +132,7 @@ for addon in ${ADDONS_DIR}/*.*/ ; do if [ -z "$GITHUB_API_TOKEN" ]; then git_clone "${GAME_GIT_REPO}" "${GAME_GIT_DIR}" if [ -n "${TAG_SUFFIX}" ]; then - GAME_NEW_VERSION=$(resolve_tag_in_branch "${GAME_GIT_DIR}" "${GAME_GIT_BRANCH}" "*-${TAG_SUFFIX}") + GAME_NEW_VERSION=$(resolve_tag_in_branch "${GAME_GIT_DIR}" "${GAME_GIT_BRANCH}" ".*-${TAG_SUFFIX}$") else GAME_NEW_VERSION=$(resolve_tag_in_branch "${GAME_GIT_DIR}" "${GAME_GIT_BRANCH}") fi