|
| 1 | + |
| 2 | +version: 2.1 |
| 3 | +orbs: |
| 4 | + commitlint: conventional-changelog/commitlint@1.0.0 |
| 5 | + |
| 6 | +executors: |
| 7 | + default-executor: |
| 8 | + docker: |
| 9 | + - image: "cimg/node:lts" |
| 10 | + working_directory: ~/project |
| 11 | + resource_class: medium |
| 12 | + |
| 13 | +commands: |
| 14 | + restore_test_cache: |
| 15 | + steps: |
| 16 | + - restore_cache: |
| 17 | + keys: |
| 18 | + - v1-deps-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}-{{ .Revision }} |
| 19 | + - v1-deps-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }} |
| 20 | + - v1-deps- |
| 21 | + save_test_cache: |
| 22 | + steps: |
| 23 | + - save_cache: |
| 24 | + key: v1-deps-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}-{{ .Revision }} |
| 25 | + paths: |
| 26 | + - node_modules |
| 27 | + - ~/.npm |
| 28 | + setup: |
| 29 | + steps: |
| 30 | + - run: |
| 31 | + name: Setup |
| 32 | + command: | |
| 33 | + npm prune |
| 34 | + test: |
| 35 | + steps: |
| 36 | + - run: |
| 37 | + name: Test |
| 38 | + command: | |
| 39 | + npm run test |
| 40 | + deploy: |
| 41 | + steps: |
| 42 | + - run: |
| 43 | + name: Deploy |
| 44 | + command: | |
| 45 | + npm run semantic-release |
| 46 | + |
| 47 | +jobs: |
| 48 | + build-and-test: |
| 49 | + executor: default-executor |
| 50 | + steps: |
| 51 | + - checkout |
| 52 | + - restore_test_cache |
| 53 | + - setup |
| 54 | + - save_test_cache |
| 55 | + - test |
| 56 | + - persist_to_workspace: |
| 57 | + root: ~/project |
| 58 | + paths: . |
| 59 | + deploy: |
| 60 | + executor: default-executor |
| 61 | + steps: |
| 62 | + - attach_workspace: |
| 63 | + at: ~/project |
| 64 | + - deploy |
| 65 | + |
| 66 | +workflows: |
| 67 | + commitlint: |
| 68 | + when: |
| 69 | + not: |
| 70 | + or: |
| 71 | + - equal: [ master, <<pipeline.git.branch>> ] |
| 72 | + - equal: [ develop, <<pipeline.git.branch>> ] |
| 73 | + - matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> } |
| 74 | + - matches: { pattern: "^release.*", value: <<pipeline.git.branch>> } |
| 75 | + jobs: |
| 76 | + - commitlint/lint: |
| 77 | + target-branch: master |
| 78 | + |
| 79 | + build-and-test-workflow: |
| 80 | + when: |
| 81 | + not: |
| 82 | + or: |
| 83 | + - equal: [ master, <<pipeline.git.branch>> ] |
| 84 | + - equal: [ develop, <<pipeline.git.branch>> ] |
| 85 | + - matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> } |
| 86 | + - matches: { pattern: "^release.*", value: <<pipeline.git.branch>> } |
| 87 | + jobs: |
| 88 | + - build-and-test |
| 89 | + |
| 90 | + deploy-workflow: |
| 91 | + when: |
| 92 | + or: |
| 93 | + - equal: [ master, <<pipeline.git.branch>> ] |
| 94 | + - equal: [ develop, <<pipeline.git.branch>> ] |
| 95 | + - matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> } |
| 96 | + - matches: { pattern: "^release.*", value: <<pipeline.git.branch>> } |
| 97 | + - matches: { pattern: "^v[0-9]*.[0-9]*.[0-9]*$", value: <<pipeline.git.branch>> } |
| 98 | + |
| 99 | + jobs: |
| 100 | + - build-and-test |
| 101 | + - deploy: |
| 102 | + context: |
| 103 | + - scratch-npm-creds |
| 104 | + requires: |
| 105 | + - build-and-test |
0 commit comments