From 147f21cd255a46ca7160423893923cbcfc7b2f60 Mon Sep 17 00:00:00 2001 From: barshaul Date: Sun, 11 Feb 2024 18:02:39 +0000 Subject: [PATCH] NPM CD: Fixed not failing on already published package --- .github/workflows/npm-cd.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/npm-cd.yml b/.github/workflows/npm-cd.yml index 99fe77f7ee..83db8ec4cc 100644 --- a/.github/workflows/npm-cd.yml +++ b/.github/workflows/npm-cd.yml @@ -86,7 +86,13 @@ jobs: shell: bash working-directory: ./node run: | - npm publish --access public + npm_publish_err=`npm publish --access public 2>&1` + if [[ ! -z "$npm_publish_err" && "$npm_publish_err" == *"You cannot publish over the previously published versions"* ]]; then + echo "Skipping publishing, package already published" + else + echo "Failed to publish with error: ${npm_publish_err}" + exit 1 + fi env: NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}