frontpage/.drone.yml

93 lines
1.9 KiB
YAML

kind: pipeline
type: docker
name: build
trigger:
event:
- push
steps:
- name: tag-commit-hash
image: alpine
commands:
- echo '${DRONE_COMMIT:0:8}' > .tags
- name: tag-dev
image: alpine
when:
branch:
- dev
commands:
- sed -i '$s/$/,dev/' .tags
- name: tag-latest
image: alpine
when:
branch:
- senpai
commands:
- sed -i '$s/$/,latest/' .tags
- name: build-image
image: plugins/docker
settings:
username:
from_secret: docker_user
password:
from_secret: docker_token
registry:
from_secret: registry_host
repo:
from_secret: local_repo
insecure: true
---
kind: pipeline
type: ssh
name: deploy
depends_on:
- build
trigger:
branch:
- senpai
- dev
event:
- push
server:
host:
from_secret: ssh_host
user:
from_secret: ssh_user
ssh_key:
from_secret: ssh_key
steps:
- name: deploy-dev
when:
branch:
- dev
environment:
DOCKER_USER:
from_secret: docker_user
DOCKER_PASS:
from_secret: docker_token
REGISTRY_HOST:
from_secret: registry_host
IMAGE: c0ntroller.de:dev
commands:
#- docker login -u $${DOCKER_USER} -p $${DOCKER_PASS}
- docker-compose -p website-dev -f docker-compose.dev.yml rm -s -v -f
- docker rmi $${REGISTRY_HOST}/$${IMAGE} || true
- docker pull $${REGISTRY_HOST}/$${IMAGE}
- docker-compose -p website-dev -f docker-compose.dev.yml up --no-build -d
- name: deploy-stable
when:
branch:
- senpai
environment:
DOCKER_USER:
from_secret: docker_user
DOCKER_PASS:
from_secret: docker_token
REGISTRY_HOST:
from_secret: registry_host
IMAGE: c0ntroller.de:latest
commands:
#- docker login -u $${DOCKER_USER} -p $${DOCKER_PASS}
- docker-compose -p website -f docker-compose.stable.yml rm -s -v -f
- docker rmi $${REGISTRY_HOST}/$${IMAGE} || true
- docker pull $${REGISTRY_HOST}/$${IMAGE}
- docker-compose -p website -f docker-compose.stable.yml up --no-build -d