From c31dc06617e051b0690e59a8c5a7f6270d0b1b85 Mon Sep 17 00:00:00 2001 From: Nicolas Renan Machado Dias Date: Mon, 6 Oct 2025 00:48:31 -0300 Subject: [PATCH] feat/added safety guard so publishing the same version number doesn't happen --- .github/workflows/publish-npm.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 8ffda35..cededc9 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -63,6 +63,13 @@ jobs: "main") NPM_TAG="latest" VERSION=$PACKAGE_VERSION + + # Find the latest tag matching this package and error if it already exists + LAST_TAG=$(git tag --list "v${PACKAGE_VERSION}" | sort -V | tail -n1) + if [ "$LAST_TAG" == "v${PACKAGE_VERSION}" ]; then + echo "Version $PACKAGE_VERSION already exists. Please update the version in package.json and jsr.json before publishing." + exit 1 + fi ;; "rc"|"beta"|"next") IDENTIFIER=$BRANCH_NAME