Skip to content

Instantly share code, notes, and snippets.

@rockchalkwushock
Created December 12, 2017 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rockchalkwushock/c82b83e1bf0bb72438e1c32754d81b85 to your computer and use it in GitHub Desktop.
Save rockchalkwushock/c82b83e1bf0bb72438e1c32754d81b85 to your computer and use it in GitHub Desktop.
Having problems with new NPM 2FA and publishing on CircleCI
version: 2
jobs:
checkout_code:
docker:
- image: circleci/node:latest
working_directory: ~/microauth-vkontakte
steps:
- checkout
- attach_workspace:
at: ~/microauth-vkontakte
- restore_cache:
keys:
- yarn-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
- yarn-cache-{{ .Branch }}
- yarn-cache-
- run: yarn install
- save_cache:
key: yarn-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths: node_modules
# Add ~/.npmrc with authToken through NPM_TOKEN to publish.
- run: 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc'
- persist_to_workspace:
root: .
paths: .
test:
docker:
- image: circleci/node:latest
working_directory: ~/microauth-vkontakte
steps:
- attach_workspace:
at: ~/microauth-vkontakte
# Install dependencies
- run: yarn install
# Using `nsp` check for vulnerabilities in package dependencies.
- run: yarn start validate.dependencies
# Validate the code through: linting, type-checking, & testing that will generate coverage.
- run: yarn start validate.withCoverage
# Report coverage to CodeCov.
- run: yarn start reportCoverage
- store_artifacts:
path: ./coverage/clover.xml
prefix: tests
- store_artifacts:
path: coverage
prefix: coverage
- store_test_results:
path: ./coverage/clover.xml
release:
docker:
- image: circleci/node:latest
working_directory: ~/microauth-vkontakte
steps:
- attach_workspace:
at: ~/microauth-vkontakte
- run: yarn install
- run: yarn start release || true
workflows:
version: 2
test_and_release:
jobs:
- checkout_code
- test:
requires:
- checkout_code
- hold:
type: approval
requires:
- test
filters:
branches:
only: master
- release:
requires:
- hold
filters:
branches:
only: master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment