Tighten the tagging logic (#146)

This commit is contained in:
Patrick Stevens
2024-05-30 12:28:43 +01:00
committed by GitHub
parent f17290d0f1
commit d5bb2726d3

View File

@@ -14,4 +14,15 @@ case "$TAG" in
esac
# target_commitish empty indicates the repo default branch
curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/Smaug123/WoofWare.Myriad/releases -d '{"tag_name":"'"$TAG"'","target_commitish":"","name":"'"$TAG"'","draft":false,"prerelease":false,"generate_release_notes":false}'
if curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/Smaug123/WoofWare.Myriad/releases -d '{"tag_name":"'"$TAG"'","target_commitish":"","name":"'"$TAG"'","draft":false,"prerelease":false,"generate_release_notes":false}' > curl_output.json; then
echo "Curl succeeded."
else
exit_message=$(jq -r --exit-status 'if .errors | length == 1 then .errors[0].code else null' curl_output.json)
if [ "$exit_message" = "already_exists" ] ; then
echo "Did not create GitHub release because it already exists at this version."
else
echo "Unexpected error output from curl: $(cat curl_output.json)"
echo "JQ output: $(exit_message)"
exit 2
fi
fi