File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 7676 INPUT_VERSION : ${{ inputs.version }}
7777 run : npm version "$INPUT_VERSION" --no-git-tag-version
7878
79+ - name : Check if version already exists on npm
80+ id : check_version
81+ run : |
82+ PKG_VERSION=$(node -p "require('./package.json').version")
83+ if npm view "$(node -p "require('./package.json').name")@${PKG_VERSION}" version >/dev/null 2>&1; then
84+ echo "exists=true" >> "$GITHUB_OUTPUT"
85+ echo "Version ${PKG_VERSION} already exists on npm, skipping publish"
86+ else
87+ echo "exists=false" >> "$GITHUB_OUTPUT"
88+ echo "Version ${PKG_VERSION} does not exist on npm, will publish"
89+ fi
90+
7991 - name : Publish to npm
92+ if : steps.check_version.outputs.exists == 'false'
8093 env :
8194 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
8295 NPM_DIST_TAG : ${{ inputs.tag }}
@@ -113,7 +126,6 @@ jobs:
113126 echo "tag=$TAG" >> "$GITHUB_OUTPUT"
114127 echo "prerelease=$PRERELEASE" >> "$GITHUB_OUTPUT"
115128
116-
117129 - name : Create GitHub Release
118130 uses : actions/github-script@v7
119131 if : ${{ github.event_name != 'release' }}
Original file line number Diff line number Diff line change 115115 "tagName" : " v${version}"
116116 },
117117 "npm" : {
118- "publish" : true
118+ "publish" : false
119119 },
120120 "github" : {
121121 "release" : true
You can’t perform that action at this time.
0 commit comments