diff --git a/package.json b/package.json index 7464bcdb..eaba9d51 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@alertlogic/paws-collector", - "version": "2.2.2", + "version": "2.2.3", "license": "MIT", "description": "Alert Logic AWS based API Poll Log Collector Library", "repository": { diff --git a/ps_spec.yml b/ps_spec.yml index c3faffae..218a923e 100644 --- a/ps_spec.yml +++ b/ps_spec.yml @@ -18,8 +18,34 @@ 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 [ $(git tag -l "$PKGVERSION") ]; then + echo "Skip tagging $PKGNAME $PKGVERSION version already exist" + else + git tag -a $PKGVERSION -m "$PKGNAME release $PKGVERSION" HEAD + if [ "$WORDCOUNT" -eq 0 ]; then + make test-all + echo "PUBLISHING $PKGNAME $PKGVERSION" + npm run lint + git push origin $PKGVERSION + npm publish --access public + else + echo "NOT PUBLISHING $PKGNAME $PKGVERSION" + fi + fi - echo done outputs: file: ./.ps_outputs/* @@ -313,7 +339,8 @@ stages: image: 422372788747.dkr.ecr.us-east-1.amazonaws.com/al-paws-collector-pipeline:latest compute_size: small_arm when: - - tag: ['\d+.\d+.\d+'] + - pull_request: + trigger_phrase: build-all-collectors commands: - source $NVM_DIR/nvm.sh && nvm use 20 - make package-all