Skip to content

Commit 13d2bca

Browse files
authored
check if version already exists before attemping npm publish (#2278)
* check if version already exists before attemping npm publish * newline * newline * newline * newline
1 parent 6b6f723 commit 13d2bca

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.github/workflows/deploy.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ jobs:
3838
- name: Publish to NPM
3939
run: |
4040
npm install -g npm@11.6.3
41-
npm publish
41+
PACKAGE_NAME=$(node -p "require('./package.json').name")
42+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
43+
if npm view "${PACKAGE_NAME}@${PACKAGE_VERSION}" version 2>/dev/null; then
44+
echo "Version ${PACKAGE_VERSION} already published, skipping..."
45+
else
46+
npm publish
47+
fi
4248
4349
- name: Load Web 3 deploy secrets
4450
uses: 1password/load-secrets-action@d1a4e73495bde3551cf63f6c048588b8f734e21d

0 commit comments

Comments
 (0)