|
| 1 | +aliases: |
| 2 | + - &restore_test_cache |
| 3 | + keys: |
| 4 | + - test-{{ .Environment.PROJECT_CACHE_VERSION }}-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package-lock.json" }} |
| 5 | + |
| 6 | + - &save_test_cache |
| 7 | + paths: |
| 8 | + - ./node_modules |
| 9 | + key: test-{{ .Environment.PROJECT_CACHE_VERSION }}-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package-lock.json" }} |
| 10 | + |
| 11 | + - &restore_release_cache |
| 12 | + keys: |
| 13 | + - release-{{ .Environment.PROJECT_CACHE_VERSION }}-{{ checksum "package-lock.json" }} |
| 14 | + |
| 15 | + - &save_release_cache |
| 16 | + paths: |
| 17 | + - ./node_modules |
| 18 | + key: release-{{ .Environment.PROJECT_CACHE_VERSION }}-{{ checksum "package-lock.json" }} |
| 19 | + |
| 20 | + - &install_npm |
| 21 | + name: install dependencies |
| 22 | + command: | |
| 23 | + npm install |
| 24 | +
|
| 25 | + - &build_package |
| 26 | + name: build package |
| 27 | + command: | |
| 28 | + npm run clean |
| 29 | + npm run build |
| 30 | +
|
| 31 | + - &filter_common |
| 32 | + branches: |
| 33 | + ignore: gh-pages |
| 34 | + tags: |
| 35 | + ignore: /.*/ |
| 36 | + |
| 37 | + - &filter_tag_all |
| 38 | + tags: |
| 39 | + only: /^v.*/ |
| 40 | + branches: |
| 41 | + ignore: /.*/ |
| 42 | + |
| 43 | + - &filter_tag_stable |
| 44 | + tags: |
| 45 | + only: /^v[0-9]+(\.[0-9]+)*$/ |
| 46 | + branches: |
| 47 | + ignore: /.*/ |
| 48 | + |
| 49 | + - &filter_tag_beta |
| 50 | + tags: |
| 51 | + only: /^v[0-9]+(\.[0-9]+)*\-[0-9]+$/ |
| 52 | + branches: |
| 53 | + ignore: /.*/ |
| 54 | + |
| 55 | + - &node_tests |
| 56 | + working_directory: ~/yeojz/filter-chunk-webpack-plugin |
| 57 | + steps: |
| 58 | + - checkout |
| 59 | + - restore-cache: *restore_test_cache |
| 60 | + - run: *install_npm |
| 61 | + - save_cache: *save_test_cache |
| 62 | + - run: *build_package |
| 63 | + - run: |
| 64 | + name: test |
| 65 | + command: npm run test |
| 66 | + |
| 67 | + - &defaults |
| 68 | + working_directory: ~/yeojz/filter-chunk-webpack-plugin |
| 69 | + docker: |
| 70 | + - image: circleci/node:8 |
| 71 | + |
| 72 | + - &npm_publish |
| 73 | + steps: |
| 74 | + - checkout |
| 75 | + - restore-cache: *restore_release_cache |
| 76 | + - run: *install_npm |
| 77 | + - run: |
| 78 | + name: install conventional-github-releaser |
| 79 | + command: npm install --no-save conventional-github-releaser |
| 80 | + - save_cache: *save_release_cache |
| 81 | + - run: |
| 82 | + name: update github release description |
| 83 | + command: npx conventional-github-releaser -p angular |
| 84 | + - run: |
| 85 | + name: build for npm |
| 86 | + command: | |
| 87 | + npm run clean |
| 88 | + npm run build |
| 89 | + - run: |
| 90 | + working_directory: ~/yeojz/filter-chunk-webpack-plugin |
| 91 | + name: publish to npm |
| 92 | + command: | |
| 93 | + echo "npm tag = $RUNTIME_NPM_TAG" |
| 94 | +
|
| 95 | + if [ -z "$CIRCLE_PULL_REQUEST" ]; then |
| 96 | + echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc |
| 97 | + npm publish --tag $RUNTIME_NPM_TAG |
| 98 | + else |
| 99 | + echo "skipping publication." |
| 100 | + fi |
| 101 | +
|
| 102 | +version: 2 |
| 103 | +jobs: |
| 104 | + node_v8: |
| 105 | + <<: *defaults |
| 106 | + steps: |
| 107 | + - checkout |
| 108 | + - restore-cache: *restore_test_cache |
| 109 | + - run: *install_npm |
| 110 | + - save_cache: *save_test_cache |
| 111 | + - run: *build_package |
| 112 | + - run: |
| 113 | + name: test |
| 114 | + command: npm run test |
| 115 | + - run: |
| 116 | + name: lint |
| 117 | + command: | |
| 118 | + npm run lint |
| 119 | + - run: |
| 120 | + name: send coverage report |
| 121 | + command: npm run codecov |
| 122 | + when: on_success |
| 123 | + |
| 124 | + node_v10: |
| 125 | + docker: |
| 126 | + - image: circleci/node:10 |
| 127 | + <<: *node_tests |
| 128 | + |
| 129 | + publish_npm_stable: |
| 130 | + environment: |
| 131 | + RUNTIME_NPM_TAG: latest |
| 132 | + <<: *defaults |
| 133 | + <<: *npm_publish |
| 134 | + |
| 135 | + publish_npm_beta: |
| 136 | + environment: |
| 137 | + RUNTIME_NPM_TAG: next |
| 138 | + <<: *defaults |
| 139 | + <<: *npm_publish |
| 140 | + |
| 141 | +workflows: |
| 142 | + version: 2 |
| 143 | + dev-builds: |
| 144 | + jobs: |
| 145 | + - node_v8: |
| 146 | + filters: *filter_common |
| 147 | + - node_v10: |
| 148 | + filters: *filter_common |
| 149 | + release-builds: |
| 150 | + jobs: |
| 151 | + - node_v8: |
| 152 | + filters: *filter_tag_all |
| 153 | + - node_v10: |
| 154 | + filters: *filter_tag_all |
| 155 | + - publish_npm_beta: |
| 156 | + requires: |
| 157 | + - node_v8 |
| 158 | + - node_v10 |
| 159 | + filters: *filter_tag_beta |
| 160 | + - hold: |
| 161 | + type: approval |
| 162 | + requires: |
| 163 | + - node_v8 |
| 164 | + - node_v10 |
| 165 | + filters: *filter_tag_stable |
| 166 | + - publish_npm_stable: |
| 167 | + requires: |
| 168 | + - hold |
| 169 | + filters: *filter_tag_stable |
| 170 | + |
0 commit comments