From 70815728fdd7d32bad0deb6b33576cf791f1dafa Mon Sep 17 00:00:00 2001 From: jdx <216188+jdx@users.noreply.github.com> Date: Mon, 18 Aug 2025 11:57:51 -0500 Subject: [PATCH] chore: remove duplicate release-plz logic --- scripts/postversion.sh | 26 +++++++++++++++++++------- scripts/release-plz.sh | 17 +++++++---------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/scripts/postversion.sh b/scripts/postversion.sh index d515de4..7a57ee4 100755 --- a/scripts/postversion.sh +++ b/scripts/postversion.sh @@ -4,16 +4,28 @@ set -euxo pipefail VERSION=$(jq -r .version package.json) MAJOR_VERSION=$(echo "$VERSION" | cut -d. -f1) -# create the version tag -git tag "v$VERSION" +# create the version tag (allow it to fail if it already exists) +git tag "v$VERSION" || echo "Tag v$VERSION already exists locally" # push changes to github git push # push the current tag to github -git push origin "v$VERSION" +git push origin "v$VERSION" || echo "Tag v$VERSION already exists on remote" + # set the major version tag to this release git tag "v$MAJOR_VERSION" -f -# push the major version tag to github -git push origin "v$MAJOR_VERSION" -f -# create a release on github -gh release create "v$VERSION" --generate-notes --verify-tag +# push the major version tag to github (retry with pull if it fails) +if ! git push origin "v$MAJOR_VERSION" -f; then + echo "Failed to push v$MAJOR_VERSION tag, pulling and retrying..." + git fetch origin "refs/tags/v$MAJOR_VERSION:refs/tags/v$MAJOR_VERSION" -f + git tag "v$MAJOR_VERSION" -f + git push origin "v$MAJOR_VERSION" -f +fi + +# check if release already exists before creating +if gh release view "v$VERSION" >/dev/null 2>&1; then + echo "Release v$VERSION already exists, skipping creation" +else + # create a release on github + gh release create "v$VERSION" --generate-notes --verify-tag +fi diff --git a/scripts/release-plz.sh b/scripts/release-plz.sh index 995fac4..ec1ddca 100755 --- a/scripts/release-plz.sh +++ b/scripts/release-plz.sh @@ -68,15 +68,12 @@ if [ -n "$latest_release_version" ] && [ "$cur_pkg_version" = "$latest_release_v echo "Updated existing release PR" fi elif [ -n "$cur_pkg_version" ] && [ "$cur_pkg_version" != "$latest_release_version" ]; then - # Package version is different from latest release, so cut a release - echo "Package version v$cur_pkg_version is newer than latest release $latest_release. Creating release." - - # Configure git for automated commits - git config user.name mise-en-dev - git config user.email 123107610+mise-en-dev@users.noreply.github.com - - ./scripts/postversion.sh + # Package version is different from latest release + echo "Package version v$cur_pkg_version is newer than latest release $latest_release." + echo "Release will be created by the release.yml workflow when the PR is merged." + # Exit successfully - the release.yml workflow handles actual release creation + exit 0 else - echo "Could not determine release status" - exit 1 + echo "No action needed" + exit 0 fi