commento/.drone/drone-home.yml

225 lines
7.0 KiB
YAML
Raw Normal View History

2020-08-19 22:18:06 +00:00
---
kind: pipeline
type: docker
name: deploy
platform:
os: linux
arch: amd64
steps:
- name: print env
image: appleboy/drone-ssh:1.6.2
settings:
envs:
- drone_tag
- drone_commit
- drone_build_number
- drone_repo_name
- drone_repo_namespace
- local_docker_registry
- registry_password
- commento_origin
- commento_smtp_host
- commento_smtp_port
- commento_smtp_username
- commento_smtp_from_address
- commento_forbid_new_owners
- commento_postgres_db
- commento_postgres_user
- commento_github_key
- commento_smtp_password
- commento_askimet_key
- commento_postgres_password
- commento_github_secret
host:
from_secret: ssh-host
key:
from_secret: ssh-key
port:
from_secret: ssh-port
script:
- rm -f env-commento
- "echo \"export LOCAL_DOCKER_REGISTRY='$${LOCAL_DOCKER_REGISTRY}'\" >> env-commento # \"local-docker-registry\""
- "echo \"export REGISTRY_PASSWORD='$${REGISTRY_PASSWORD}'\" >> env-commento # \"registry-password\""
- "echo \"export COMMENTO_ORIGIN='$${COMMENTO_ORIGIN}'\" >> env-commento # \"commento-origin\""
- "echo \"export COMMENTO_SMTP_HOST='$${COMMENTO_SMTP_HOST}'\" >> env-commento # \"commento-smtp-host\""
- "echo \"export COMMENTO_SMTP_PORT='$${COMMENTO_SMTP_PORT}'\" >> env-commento # \"commento-smtp-port\""
- "echo \"export COMMENTO_SMTP_USERNAME='$${COMMENTO_SMTP_USERNAME}'\" >> env-commento # \"commento-smtp-username\""
- "echo \"export COMMENTO_SMTP_FROM_ADDRESS='$${COMMENTO_SMTP_FROM_ADDRESS}'\" >> env-commento # \"commento-smtp-from-address\""
- "echo \"export COMMENTO_FORBID_NEW_OWNERS='$${COMMENTO_FORBID_NEW_OWNERS}'\" >> env-commento # \"commento-forbid-new-owners\""
- "echo \"export COMMENTO_POSTGRES_DB='$${COMMENTO_POSTGRES_DB}'\" >> env-commento # \"commento-postgres-db\""
- "echo \"export COMMENTO_POSTGRES_USER='$${COMMENTO_POSTGRES_USER}'\" >> env-commento # \"commento-postgres-user\""
- "echo \"export COMMENTO_GITHUB_KEY='$${COMMENTO_GITHUB_KEY}'\" >> env-commento # \"commento-github-key\""
- "echo \"export COMMENTO_SMTP_PASSWORD='$${COMMENTO_SMTP_PASSWORD}'\" >> env-commento # \"commento-smtp-password\""
- "echo \"export COMMENTO_ASKIMET_KEY='$${COMMENTO_ASKIMET_KEY}'\" >> env-commento # \"commento-askimet-key\""
- "echo \"export COMMENTO_POSTGRES_PASSWORD='$${COMMENTO_POSTGRES_PASSWORD}'\" >> env-commento # \"commento-postgres-password\""
- "echo \"export COMMENTO_GITHUB_SECRET='$${COMMENTO_GITHUB_SECRET}'\" >> env-commento # \"commento-github-secret\""
username:
from_secret: ssh-user
environment:
COMMENTO_ASKIMET_KEY:
from_secret: commento-askimet-key
COMMENTO_FORBID_NEW_OWNERS:
from_secret: commento-forbid-new-owners
COMMENTO_GITHUB_KEY:
from_secret: commento-github-key
COMMENTO_GITHUB_SECRET:
from_secret: commento-github-secret
COMMENTO_ORIGIN:
from_secret: commento-origin
COMMENTO_POSTGRES_DB:
from_secret: commento-postgres-db
COMMENTO_POSTGRES_PASSWORD:
from_secret: commento-postgres-password
COMMENTO_POSTGRES_USER:
from_secret: commento-postgres-user
COMMENTO_SMTP_FROM_ADDRESS:
from_secret: commento-smtp-from-address
COMMENTO_SMTP_HOST:
from_secret: commento-smtp-host
COMMENTO_SMTP_PASSWORD:
from_secret: commento-smtp-password
COMMENTO_SMTP_PORT:
from_secret: commento-smtp-port
COMMENTO_SMTP_USERNAME:
from_secret: commento-smtp-username
LOCAL_DOCKER_REGISTRY:
from_secret: local-docker-registry
REGISTRY_PASSWORD:
from_secret: registry-password
- name: scp
image: appleboy/drone-scp:1.6.2
settings:
command_timeout: 2m
host:
from_secret: ssh-host
key:
from_secret: ssh-key
port:
from_secret: ssh-port
source:
- .
target: /stack/commento
username:
from_secret: ssh-user
- name: wait
image: alpine
commands:
- sleep 15
- name: "dockerbuild:"
image: docker:dind
commands:
- set -e
- sh .drone/login.sh
- sh .drone/build.sh
- sh .drone/push.sh
- sh .drone/logout.sh
environment:
LOCAL_DOCKER_REGISTRY:
from_secret: local-docker-registry
REGISTRY_PASSWORD:
from_secret: registry-password
volumes:
- name: dockersock
path: /var/run
- name: deploy
image: appleboy/drone-ssh:1.6.2
settings:
envs:
- drone_tag
- drone_commit
- drone_build_number
- drone_repo_name
- drone_repo_namespace
- commento_origin
- commento_smtp_host
- commento_smtp_port
- commento_smtp_username
- commento_smtp_from_address
- commento_forbid_new_owners
- commento_postgres_db
- commento_postgres_user
- commento_github_key
- commento_smtp_password
- commento_askimet_key
- commento_postgres_password
- commento_github_secret
host:
from_secret: ssh-host
key:
from_secret: ssh-key
port:
from_secret: ssh-port
script:
- export COMMENTO_SMTP_PASSWORD=$${COMMENTO_SMTP_PASSWORD}
- export COMMENTO_ASKIMET_KEY=$${COMMENTO_ASKIMET_KEY}
- export COMMENTO_POSTGRES_PASSWORD=$${COMMENTO_POSTGRES_PASSWORD}
- export COMMENTO_GITHUB_SECRET=$${COMMENTO_GITHUB_SECRET}
- export COMMENTO_ORIGIN=$${COMMENTO_ORIGIN}
- export COMMENTO_SMTP_HOST=$${COMMENTO_SMTP_HOST}
- export COMMENTO_SMTP_PORT=$${COMMENTO_SMTP_PORT}
- export COMMENTO_SMTP_USERNAME=$${COMMENTO_SMTP_USERNAME}
- export COMMENTO_SMTP_FROM_ADDRESS=$${COMMENTO_SMTP_FROM_ADDRESS}
- export COMMENTO_FORBID_NEW_OWNERS=$${COMMENTO_FORBID_NEW_OWNERS}
- export COMMENTO_POSTGRES_DB=$${COMMENTO_POSTGRES_DB}
- export COMMENTO_POSTGRES_USER=$${COMMENTO_POSTGRES_USER}
- export COMMENTO_GITHUB_KEY=$${COMMENTO_GITHUB_KEY}
- set -e
- cd /stack/commento
- sh .drone/login.sh
- sh .drone/pull.sh
- sh .drone/deploy.sh
username:
from_secret: ssh-user
environment:
COMMENTO_ASKIMET_KEY:
from_secret: commento-askimet-key
COMMENTO_FORBID_NEW_OWNERS:
from_secret: commento-forbid-new-owners
COMMENTO_GITHUB_KEY:
from_secret: commento-github-key
COMMENTO_GITHUB_SECRET:
from_secret: commento-github-secret
COMMENTO_ORIGIN:
from_secret: commento-origin
COMMENTO_POSTGRES_DB:
from_secret: commento-postgres-db
COMMENTO_POSTGRES_PASSWORD:
from_secret: commento-postgres-password
COMMENTO_POSTGRES_USER:
from_secret: commento-postgres-user
COMMENTO_SMTP_FROM_ADDRESS:
from_secret: commento-smtp-from-address
COMMENTO_SMTP_HOST:
from_secret: commento-smtp-host
COMMENTO_SMTP_PASSWORD:
from_secret: commento-smtp-password
COMMENTO_SMTP_PORT:
from_secret: commento-smtp-port
COMMENTO_SMTP_USERNAME:
from_secret: commento-smtp-username
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
- name: ca
path: /etc/docker/certs.d
volumes:
- name: dockersock
temp: {}
- name: ca
host:
path: /etc/docker/certs.d
...