From c3c8e186998a6c57e954b5cc0b2c27cd4943a6ee Mon Sep 17 00:00:00 2001 From: Rakhi Mundhada Date: Fri, 21 Jun 2024 17:29:24 +0530 Subject: [PATCH] publish the lib while merge to master --- ps_spec.yml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/ps_spec.yml b/ps_spec.yml index c3faffae..06ea4bac 100644 --- a/ps_spec.yml +++ b/ps_spec.yml @@ -18,8 +18,28 @@ stages: image: node:20 compute_size: small commands: - - set -ex - - make test-all + - | + set -ex + echo //registry.npmjs.org/:_authToken=$NPM_TOKEN > .npmrc + npm whoami + + PKGNAME=$(node -e 'console.log(require("./package.json").name)') + PKGVERSION=$(node -e 'console.log(require("./package.json").version)') + WORDCOUNT=$(npm view "${PKGNAME}@${PKGVERSION}" | wc -c) + + git config --global credential.helper \'store\' || true + echo "https://$ALPS_GH_USER:$ALPS_GH_TOKEN@github.com" > ~/.git-credentials + + npm install + + if [ "$WORDCOUNT" -eq 0 ]; then + make test-all + echo "PUBLISHING $PKGNAME $PKGVERSION" + npm run lint + npm publish --access public + else + echo "NOT PUBLISHING $PKGNAME $PKGVERSION" + fi - echo done outputs: file: ./.ps_outputs/*