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 16:04:11 +02:00
parent aa2d2590cb
commit 4905f89799

View File

@ -1,29 +1,49 @@
version: 2
jobs:
build:
build_latest:
docker:
- image: circleci/node:14.17.2-browsers
- image: circleci/node:14.17.3-browsers
working_directory: ~/twhelp
steps:
- 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/twhelp-version-website:latest .
# deploy the image
- run: docker push $DOCKER_LOGIN/twhelp-version-website:latest
build_version:
docker:
- image: circleci/node:14.17.3-browsers
working_directory: ~/twhelp
steps:
- checkout
- setup_remote_docker:
version: 20.10.2
- run: |
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
# build the application image
- run: docker build -t $DOCKER_LOGIN/twhelp-version-website:$(echo $CIRCLE_TAG | sed -r 's/^.{1}//') .
# deploy the image
- run: docker push $DOCKER_LOGIN/twhelp-version-website:$(echo $CIRCLE_TAG | sed -r 's/^.{1}//')
workflows:
version: 2
deploy_prod:
deploy_latest:
jobs:
- build:
- build_latest:
context: TWHelp
filters:
branches:
only:
- master
deploy_version:
jobs:
- build_version:
context: TWHelp
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/