From 0010698bc85623a5f17babc77d04fac4ae710926 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Tue, 23 Apr 2024 20:19:34 +0200 Subject: [PATCH] fixup! ci --- kodev | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/kodev b/kodev index 9d13c583c732..f25f99936fd9 100755 --- a/kodev +++ b/kodev @@ -1346,12 +1346,24 @@ function kodev-ci-gh-release() { local new_commit old_commit run gh repo set-default "${GITHUB_REPOSITORY}" new_commit="$(git rev-parse HEAD)" + info -cBROWN "new_commit: ${new_commit}" old_commit="$(gh release view "${tag}" --json targetCommitish | jq -r .targetCommitish || true)" - if [[ -n "${old_commit}" ]] && [[ "${old_commit}" != "${new_commit}" ]]; then + info -cBROWN "old_commit: ${old_commit}" + if [[ -n "${old_commit}" ]]; then + old_commit="$(git rev-parse "${old_commit}")" + info -cBROWN "old_commit: ${old_commit}" + fi + local create_release=0 + if [[ -z "${old_commit}" ]]; then + create_release=1 + elif [[ "${old_commit}" != "${new_commit}" ]]; then run gh release delete --cleanup-tag --yes "${tag}" + create_release=1 + fi + if [[ "${create_release}" -ne 0 ]]; then run git tag --force "${tag}" - run git push -f "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" "${tag}" - run gh release create --notes='.' --prerelease --target="${tag}" --title="${tag}" "${tag}" + run git push -f "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" "refs/tags/${tag}" + run gh release create --notes='.' --prerelease --target="${new_commit}" --title="${tag}" "${tag}" fi run gh release upload "${tag}" "$@" }