From 62a3d3ecc4a834a281cc587d241fcdb1c5ecf837 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 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/npm-cd.yml b/.github/workflows/npm-cd.yml index 99fe77f7ee..3d30c3db03 100644 --- a/.github/workflows/npm-cd.yml +++ b/.github/workflows/npm-cd.yml @@ -86,7 +86,15 @@ jobs: shell: bash working-directory: ./node run: | - npm publish --access public + set +e + 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 }}