docker-backuppc/.circleci/config.yml

48 lines
1.2 KiB
YAML
Raw Normal View History

2018-09-16 11:40:58 +02:00
# Configure CircleCI
2018-09-16 11:39:13 +02:00
version: 2
jobs:
build:
2018-09-16 12:29:15 +02:00
machine: true
2018-09-16 11:39:13 +02:00
steps:
- checkout
- run:
command:
2018-09-16 14:49:34 +02:00
docker build -t adferrand/backuppc .
2018-09-16 11:39:13 +02:00
- run:
2018-09-16 12:03:05 +02:00
command: |
mkdir -p workspace
2018-09-16 14:49:34 +02:00
docker save adferrand/backuppc > workspace/docker-backuppc.tar
2018-09-16 11:39:13 +02:00
- persist_to_workspace:
2018-09-16 12:03:05 +02:00
root: workspace
2018-09-16 11:39:13 +02:00
paths:
- docker-backuppc.tar
deploy:
2018-09-16 12:29:15 +02:00
machine: true
2018-09-16 11:39:13 +02:00
steps:
- attach_workspace:
at: /tmp/workspace
2018-09-16 14:49:34 +02:00
- run:
command:
echo 'if [ ${CIRCLE_BRANCH} = master ]; then DOCKER_TAG=latest else DOCKER_TAG=${CIRCLE_TAG:-${CIRCLE_BRANCH}} fi; export DOCKER_TAG' >> $BASH_ENV
2018-09-16 11:39:13 +02:00
- run:
command:
docker load < /tmp/workspace/docker-backuppc.tar
- deploy:
2018-09-16 14:57:29 +02:00
command: |
2018-09-16 15:52:35 +02:00
if [ ${CIRCLE_BRANCH} = master ]; then DOCKER_TAG=latest else DOCKER_TAG=${CIRCLE_TAG:-${CIRCLE_BRANCH}} fi;
2018-09-16 20:06:17 +02:00
echo ${DOCKER_TAG}
2018-09-16 11:39:13 +02:00
workflows:
version: 2
build-n-deploy:
jobs:
- build:
filters:
2018-09-16 11:49:57 +02:00
tags:
only: ^[0-9.]+
2018-09-16 11:39:13 +02:00
- deploy:
requires:
- build
filters:
2018-09-16 11:49:57 +02:00
tags:
only: ^[0-9.]+