feat: add a new workflow to .circleci/config.yml triggered by pushing a new git tag

This commit is contained in:
Dawid Wysokiński 2021-07-08 15:42:11 +02:00
parent 3f9ef419cf
commit 3ceb14223b
1 changed files with 26 additions and 5 deletions

View File

@ -1,6 +1,6 @@
version: 2
jobs:
build:
build_latest:
docker:
- image: circleci/golang:1.16
working_directory: ~/zdamegzzawodowybackend
@ -11,16 +11,37 @@ jobs:
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
# build the application image
- run: docker build -t $DOCKER_LOGIN/zdam-egzamin-zawodowy-backend:latest .
# deploy the image
- run: docker push $DOCKER_LOGIN/zdam-egzamin-zawodowy-backend:latest
build_version:
docker:
- image: circleci/golang:1.16
working_directory: ~/zdamegzzawodowybackend
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-backend:$(echo $CIRCLE_TAG | sed -r 's/^.{1}//') .
# deploy the image
- run: docker push $DOCKER_LOGIN/zdam-egzamin-zawodowy-backend:$(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
- master
deploy_version:
jobs:
- build_version:
context: Zdam-Egzamin-Zawodowy
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/