diff --git a/forgejo-release.sh b/forgejo-release.sh index c7d327b..4a2a9b2 100755 --- a/forgejo-release.sh +++ b/forgejo-release.sh @@ -32,9 +32,14 @@ ensure_tag() { if api GET repos/$REPO/tags/$TAG > $TMP_DIR/tag.json ; then local sha=$(jq --raw-output .commit.sha < $TMP_DIR/tag.json) if test "$sha" != "$SHA" ; then - cat $TMP_DIR/tag.json - echo "the tag SHA in the $REPO repository does not match the tag SHA that triggered the build: $SHA" - false + if test "$OVERRIDE" = "true"; then + echo "Removing existing tag, ${TAG}" + api DELETE repos/$REPO/tags/$TAG >& /dev/null || true + else + cat $TMP_DIR/tag.json + echo "the tag SHA in the $REPO repository does not match the tag SHA that triggered the build: $SHA" + false + fi fi else api POST repos/$REPO/tags --data-raw '{"tag_name": "'$TAG'", "target": "'$SHA'"}'