From 5744a53b3a32f841dde518da770b03e9d6a37135 Mon Sep 17 00:00:00 2001 From: Kichiyaki Date: Thu, 8 Jul 2021 15:51:31 +0200 Subject: [PATCH] feat: add a new workflow to .circleci/config.yml triggered by pushing a new git tag --- .circleci/config.yml | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ddf2eaa..d18fb62 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,22 +8,41 @@ jobs: - checkout - setup_remote_docker: version: 20.10.2 - # start proprietary DB using private Docker image - # with credentials stored in the UI - run: | docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD # build the application image - run: docker build -t $DOCKER_LOGIN/zdam-egzamin-zawodowy-website:latest . - # deploy the image - run: docker push $DOCKER_LOGIN/zdam-egzamin-zawodowy-website:latest + build_version: + docker: + - image: circleci/node:14.17.3 + working_directory: ~/zdamegzaminzawodowy + steps: + - checkout + - setup_remote_docker + - run: | + docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD + # build the application image + - run: docker build -t $DOCKER_LOGIN/zdam-egzamin-zawodowy-website:$(echo $CIRCLE_TAG | sed -r 's/^.{1}//') . + # deploy the image + - run: docker push $DOCKER_LOGIN/zdam-egzamin-zawodowy-website:$(echo $CIRCLE_TAG | sed -r 's/^.{1}//') workflows: version: 2 - deploy_prod: + deploy_latest: jobs: - - build: + - build_latest: context: Zdam-Egzamin-Zawodowy filters: branches: only: - - master \ No newline at end of file + - master + deploy_version: + jobs: + - build_version: + context: Zdam-Egzamin-Zawodowy + filters: + tags: + only: /^v.*/ + branches: + ignore: /.*/