mirror of
https://github.com/Smaug123/WoofWare.Myriad
synced 2025-10-06 04:28:42 +00:00
Tighten the tagging logic (#146)
This commit is contained in:
13
.github/workflows/tag.sh
vendored
13
.github/workflows/tag.sh
vendored
@@ -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
|
||||
|
Reference in New Issue
Block a user