File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -120,12 +120,25 @@ done
120120section " Versão"
121121
122122if [[ -z " $VERSION " ]]; then
123- cd " $REPO_ROOT "
124- VERSION=$( git describe --tags --abbrev=0 2> /dev/null | sed ' s/^v//' || true)
123+ info " Buscando" " última release em github.com/${GITHUB_REPO} ..."
124+
125+ LATEST_JSON=" $WORK_DIR /latest_release.json"
126+ HTTP_CODE=$( curl -sL -w " %{http_code}" \
127+ -H " Accept: application/vnd.github+json" \
128+ -o " $LATEST_JSON " \
129+ " https://api.github.com/repos/${GITHUB_REPO} /releases/latest" )
130+
131+ if [[ " $HTTP_CODE " != " 200" ]]; then
132+ die " GitHub API retornou HTTP $HTTP_CODE . Verifique se o repositório tem releases publicadas."
133+ fi
134+
135+ VERSION=$( grep ' "tag_name"' " $LATEST_JSON " | sed ' s/.*"tag_name": *"\([^"]*\)".*/\1/' | sed ' s/^v//' )
136+
125137 if [[ -z " $VERSION " ]]; then
126- die " Nenhuma tag encontrada . Use --version <x.y.z> para especificar a versão ."
138+ die " Não foi possível extrair a versão da API do GitHub . Use --version <x.y.z>."
127139 fi
128- info " Detectada" " v${VERSION} (última tag git)"
140+
141+ info " Detectada" " v${VERSION} (última release no GitHub)"
129142else
130143 VERSION=" ${VERSION# v} "
131144 info " Especificada" " v${VERSION} "
You can’t perform that action at this time.
0 commit comments