|
| 1 | +version: 2.1 |
| 2 | +orbs: |
| 3 | + docker-publish: circleci/docker-publish@0.1.7 |
| 4 | + shellcheck: circleci/shellcheck@1.3.11 |
| 5 | + |
| 6 | +x-aliases: |
| 7 | + docker-publish-args: &docker-publish-args |
| 8 | + requires: |
| 9 | + - shellcheck/check |
| 10 | + registry: $DOCKER_REGISTRY |
| 11 | + image: $DOCKER_IMAGE |
| 12 | + after_build: |
| 13 | + - run: |
| 14 | + name: Test generated image |
| 15 | + command: ./test.sh |
| 16 | + filter-only-develop: &filter-only-develop |
| 17 | + filters: |
| 18 | + branches: |
| 19 | + only: |
| 20 | + - develop |
| 21 | + filter-only-master: &filter-only-master |
| 22 | + filters: |
| 23 | + branches: |
| 24 | + only: |
| 25 | + - master |
| 26 | + filter-except-main: &filter-except-main |
| 27 | + filters: |
| 28 | + branches: |
| 29 | + ignore: |
| 30 | + - develop |
| 31 | + - master |
| 32 | + filter-only-tagged: &filter-only-tagged |
| 33 | + filters: |
| 34 | + branches: |
| 35 | + ignore: |
| 36 | + - /.*/ |
| 37 | + tags: |
| 38 | + only: |
| 39 | + - /.*/ |
| 40 | + filter-branch-or-tagged: &filter-branch-or-tagged |
| 41 | + filters: |
| 42 | + tags: |
| 43 | + only: |
| 44 | + - /.*/ |
| 45 | + |
| 46 | +workflows: |
| 47 | + version: 2 |
| 48 | + build: |
| 49 | + jobs: |
| 50 | + - shellcheck/check: |
| 51 | + <<: *filter-branch-or-tagged |
| 52 | + pre-steps: |
| 53 | + - run: |
| 54 | + name: "Install git and SSH client" |
| 55 | + command: | |
| 56 | + apk add \ |
| 57 | + --update-cache \ |
| 58 | + --no-progress \ |
| 59 | + git \ |
| 60 | + openssh-client |
| 61 | + - docker-publish/publish: |
| 62 | + name: docker-build-branch |
| 63 | + <<: *docker-publish-args |
| 64 | + <<: *filter-except-main |
| 65 | + deploy: false |
| 66 | + - docker-publish/publish: |
| 67 | + name: docker-build-and-publish-develop |
| 68 | + <<: *docker-publish-args |
| 69 | + <<: *filter-only-develop |
| 70 | + tag: edge |
| 71 | + - docker-publish/publish: |
| 72 | + name: docker-build-and-publish-master |
| 73 | + <<: *docker-publish-args |
| 74 | + <<: *filter-only-master |
| 75 | + tag: latest |
| 76 | + - docker-publish/publish: |
| 77 | + name: docker-build-and-publish-release |
| 78 | + <<: *docker-publish-args |
| 79 | + <<: *filter-only-tagged |
| 80 | + tag: $CIRCLE_TAG |
0 commit comments