feat: add a new workflow to .circleci/config.yml triggered by pushing a new git tag
This commit is contained in:
parent
3f9ef419cf
commit
3ceb14223b
|
@ -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: /.*/
|
||||
|
|
Reference in New Issue