From 5769fbb61ca99ebd1f7e84a6826f691aedb03cec Mon Sep 17 00:00:00 2001 From: Kichiyaki Date: Thu, 8 Jul 2021 15:37:00 +0200 Subject: [PATCH] feat: add a new workflow to .circleci/config.yml triggered by pushing a new git tag --- .circleci/config.yml | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 454a23e..64886db 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,6 @@ version: 2 jobs: - build: + build_latest: docker: - image: circleci/golang:1.16 working_directory: ~/twhelpdcbot @@ -13,17 +13,39 @@ jobs: docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD # build the application image - run: docker build -t $DOCKER_LOGIN/twhelp-dcbot:latest . - # deploy the image - run: docker push $DOCKER_LOGIN/twhelp-dcbot:latest + build_version: + docker: + - image: circleci/golang:1.16 + working_directory: ~/twhelpdcbot + steps: + - checkout + - setup_remote_docker + # 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/twhelp-dcbot:$(echo $CIRCLE_TAG | sed -r 's/^.{1}//') . + # deploy the image + - run: docker push $DOCKER_LOGIN/twhelp-dcbot:$(echo $CIRCLE_TAG | sed -r 's/^.{1}//') workflows: version: 2 - deploy_prod: + deploy_latest: jobs: - - build: + - build_latest: context: TWHelp filters: branches: only: - master - \ No newline at end of file + deploy_version: + jobs: + - build_version: + context: TWHelp + filters: + tags: + only: /^v.*/ + branches: + ignore: /.*/