version: 2.1 defaults: &defaults working_directory: ~/repo docker: - image: cimg/node:19.7.0 jobs: build: <<: *defaults steps: - checkout - run: name: Install dependencies command: npm i - run: name: Run tests command: npm run test - run: name: Build command: npm run build - persist_to_workspace: root: ~/repo paths: - ./dist - ./LICENSE - ./package.json - ./README.md deploy: <<: *defaults steps: - attach_workspace: at: ~/repo - run: name: Publish package command: | npm set //registry.npmjs.org/:_authToken=$npm_TOKEN npm config set tag-version-prefix 'v' npm publish --tag << pipeline.git.tag >> workflows: main: jobs: - build: filters: branches: ignore: /.*/ tags: only: /^v.*/ - deploy: requires: - build filters: branches: ignore: /.*/ tags: only: /^v.*/