forked from Kasparvongruenberg/products_service-1
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.drone.yml
90 lines (86 loc) · 2.85 KB
/
.drone.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
services:
postgres:
image: postgres:10.4-alpine
environment:
- POSTGRES_USER=root
- POSTGRES_PASSWORD=root
- POSTGRES_DB=db
pipeline:
test:
image: python:3.6
commands:
- bash scripts/tcp-port-wait.sh $${DATABASE_HOST} $${DATABASE_PORT}
- bash scripts/run-tests.sh --ci
environment:
- AWS_ACCESS_KEY_ID=example
- AWS_SECRET_ACCESS_KEY=example
- AWS_STORAGE_BUCKET_NAME=example
- DATABASE_ENGINE=postgresql
- DATABASE_NAME=db
- DATABASE_USER=root
- DATABASE_PASSWORD=root
- DATABASE_HOST=postgres
- DATABASE_PORT=5432
- DJANGO_SETTINGS_MODULE=products_service.settings.base
- SECRET_KEY=nothing
when:
event: [pull_request, push, tag]
build-docker-image-tag:
image: plugins/docker
registry:
from_secret: DOCKER_REGISTRY
repo:
from_secret: DOCKER_REPO
username:
from_secret: DOCKER_USERNAME
password:
from_secret: DOCKER_PASSWORD
auto_tag: true
insecure: true
file: Dockerfile
when:
event: [tag]
status: [success]
deploy-docs:
image: python:3.6
commands:
- bash scripts/tcp-port-wait.sh $${DATABASE_HOST} $${DATABASE_PORT}
- pip install -r requirements/base.txt
- python manage.py generate_swagger > swagger.json
- eval "$(ssh-agent -s)"
- mkdir -p /root/.ssh
- echo "$${SSH_KEY}\n" > /root/.ssh/id_rsa
- echo "$${SSH_PUBLIC_KEY}\n" > /root/.ssh/id_rsa.pub
- ssh-keyscan -t rsa github.com >> /root/.ssh/known_hosts
- chmod 600 /root/.ssh/id_rsa*
- ssh-add -k /root/.ssh/id_rsa
- git config --global user.email "engine@humanitec.com"
- git config --global user.name "HumanitecBot"
- git clone git@github.com:Humanitec/docs-site.git
- mkdir -p docs-site/hugo/content/marketplace/products-module/products-service/
- mkdir -p docs-site/api/marketplace/products-service/
- cd docs-site/hugo/content/marketplace/products-module/products-service/
- cp ../../../../../../README.md _index.md -r
- cd ../../../../../api/marketplace/products-service
- cp ../../../../swagger.json swagger.json -r
- cd ../../../
- git add .
- git diff-index --quiet HEAD || git commit -m "Updated documentation for Products service"
- git push origin master
environment:
- AWS_ACCESS_KEY_ID=example
- AWS_SECRET_ACCESS_KEY=example
- AWS_STORAGE_BUCKET_NAME=example
- DATABASE_ENGINE=postgresql
- DATABASE_NAME=db
- DATABASE_USER=root
- DATABASE_PASSWORD=root
- DATABASE_HOST=postgres
- DATABASE_PORT=5432
- DJANGO_SETTINGS_MODULE=products_service.settings.base
- SECRET_KEY=nothing
secrets: [NPM_USER, NPM_EMAIL, SSH_KEY, SSH_PUBLIC_KEY]
when:
event: [push, tag]
branch: [master]
status: [success]