Merge pull request #14 from tribalwarshelp/feat/ci-support-for-git-tags

feat: add a new workflow triggered by pushing a new git tag
This commit is contained in:
Dawid Wysokiński 2021-07-08 06:30:10 +02:00 committed by GitHub
commit dafead2b3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
version: 2 version: 2
jobs: jobs:
build: build_latest:
docker: docker:
- image: circleci/golang:1.16 - image: circleci/golang:1.16
working_directory: ~/twhelpcron working_directory: ~/twhelpcron
@ -13,17 +13,39 @@ jobs:
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
# build the application image # build the application image
- run: docker build -t $DOCKER_LOGIN/twhelp-cron:latest . - run: docker build -t $DOCKER_LOGIN/twhelp-cron:latest .
# deploy the image # deploy the image
- run: docker push $DOCKER_LOGIN/twhelp-cron:latest - run: docker push $DOCKER_LOGIN/twhelp-cron:latest
build_version:
docker:
- image: circleci/golang:1.16
working_directory: ~/twhelpcron
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-cron:$CIRCLE_TAG .
# deploy the image
- run: docker push $DOCKER_LOGIN/twhelp-cron:$CIRCLE_TAG
workflows: workflows:
version: 2 version: 2
deploy_prod: deploy_latest:
jobs: jobs:
- build: - build_latest:
context: TWHelp context: TWHelp
filters: filters:
branches: branches:
only: only:
- master - master
deploy_version:
jobs:
- build_version:
context: TWHelp
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/