config.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. version: 2
  2. jobs:
  3. build:
  4. working_directory: ~/repo
  5. docker:
  6. - image: circleci/node:8.11.3
  7. steps:
  8. - checkout
  9. - run:
  10. name: authorize npm
  11. command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
  12. - restore_cache:
  13. key: dependency-cache-{{ checksum "package.json" }}
  14. - run:
  15. name: run npm install
  16. command: npm install
  17. - save_cache:
  18. key: dependency-cache-{{ checksum "package.json" }}
  19. paths:
  20. - ./node_modules
  21. - run: mkdir ~/junit
  22. - run:
  23. name: build & test
  24. command: npm run ci
  25. when: always
  26. - run: cp test-results.xml ~/junit/test-results.xml
  27. - store_test_results:
  28. path: ~/junit
  29. - store_artifacts:
  30. path: ~/junit
  31. build_deploy_npm:
  32. working_directory: ~/repo
  33. docker:
  34. - image: circleci/node:8.11.3
  35. steps:
  36. - checkout
  37. - run:
  38. name: authorize npm
  39. command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
  40. - restore_cache:
  41. key: dependency-cache-{{ checksum "package.json" }}
  42. - run:
  43. name: run npm install
  44. command: npm install
  45. - save_cache:
  46. key: dependency-cache-{{ checksum "package.json" }}
  47. paths:
  48. - ./node_modules
  49. - run: mkdir ~/junit
  50. - run:
  51. name: build & test
  52. command: npm run ci
  53. when: always
  54. - run: cp test-results.xml ~/junit/test-results.xml
  55. - store_test_results:
  56. path: ~/junit
  57. - store_artifacts:
  58. path: ~/junit
  59. - run:
  60. name: publish package to npm
  61. command: npm publish
  62. workflows:
  63. version: 2
  64. build_deploy:
  65. jobs:
  66. - build:
  67. context: secrets
  68. - build_deploy_npm:
  69. context: secrets
  70. filters:
  71. tags:
  72. only: /.*/
  73. branches:
  74. ignore: /.*/