Skip to content

Commit

Permalink
fixup! ci
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit-pierre committed Apr 23, 2024
1 parent 64f317c commit 0010698
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions kodev
Original file line number Diff line number Diff line change
Expand Up @@ -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}" "$@"
}
Expand Down

0 comments on commit 0010698

Please sign in to comment.