commento/.drone/drone-home.yml

232 lines
6.0 KiB
YAML
Raw Normal View History

2020-08-28 20:49:27 +00:00
---
kind: pipeline
type: docker
name: register
platform:
os: linux
arch: amd64
clone:
disable: true
trigger:
event:
exclude:
- promote
---
kind: pipeline
type: docker
name: deploy
platform:
os: linux
arch: amd64
steps:
- name: print env
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
settings:
envs:
- drone_tag
- drone_commit
- drone_build_number
- drone_repo_name
- drone_repo_namespace
- origin
- smtp_host
- smtp_port
- smtp_username
- smtp_from_address
- forbid_new_owners
- postgres_db
- postgres_user
- github_key
- smtp_password
- askimet_key
- postgres_password
- github_secret
host: ${SSH_HOST}
key: ${SSH_KEY}
passphrase: ${SSH_PASSPHRASE}
port: ${SSH_PORT}
script:
- rm -f env-commento
- "echo \"export ORIGIN='$${ORIGIN}'\" >> env-commento # \"origin\""
- "echo \"export SMTP_HOST='$${SMTP_HOST}'\" >> env-commento # \"smtp-host\""
- "echo \"export SMTP_PORT='$${SMTP_PORT}'\" >> env-commento # \"smtp-port\""
- "echo \"export SMTP_USERNAME='$${SMTP_USERNAME}'\" >> env-commento # \"smtp-username\""
- "echo \"export SMTP_FROM_ADDRESS='$${SMTP_FROM_ADDRESS}'\" >> env-commento # \"smtp-from-address\""
- "echo \"export FORBID_NEW_OWNERS='$${FORBID_NEW_OWNERS}'\" >> env-commento # \"forbid-new-owners\""
- "echo \"export POSTGRES_DB='$${POSTGRES_DB}'\" >> env-commento # \"postgres-db\""
- "echo \"export POSTGRES_USER='$${POSTGRES_USER}'\" >> env-commento # \"postgres-user\""
- "echo \"export GITHUB_KEY='$${GITHUB_KEY}'\" >> env-commento # \"github-key\""
- "echo \"export SMTP_PASSWORD='$${SMTP_PASSWORD}'\" >> env-commento # \"smtp-password\""
- "echo \"export ASKIMET_KEY='$${ASKIMET_KEY}'\" >> env-commento # \"askimet-key\""
- "echo \"export POSTGRES_PASSWORD='$${POSTGRES_PASSWORD}'\" >> env-commento # \"postgres-password\""
- "echo \"export GITHUB_SECRET='$${GITHUB_SECRET}'\" >> env-commento # \"github-secret\""
username: ${SSH_USER}
environment:
ASKIMET_KEY:
from_secret: askimet-key
FORBID_NEW_OWNERS:
from_secret: forbid-new-owners
GITHUB_KEY:
from_secret: github-key
GITHUB_SECRET:
from_secret: github-secret
ORIGIN:
from_secret: origin
POSTGRES_DB:
from_secret: postgres-db
POSTGRES_PASSWORD:
from_secret: postgres-password
POSTGRES_USER:
from_secret: postgres-user
SMTP_FROM_ADDRESS:
from_secret: smtp-from-address
SMTP_HOST:
from_secret: smtp-host
SMTP_PASSWORD:
from_secret: smtp-password
SMTP_PORT:
from_secret: smtp-port
SMTP_USERNAME:
from_secret: smtp-username
- name: scp
image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47
settings:
command_timeout: 2m
host: ${SSH_HOST}
key: ${SSH_KEY}
passphrase: ${SSH_PASSPHRASE}
port: ${SSH_PORT}
source:
- .
target: /stack/commento
username: ${SSH_USER}
- name: wait
image: alpine:3.12.0@sha256:90baa0922fe90624b05cb5766fa5da4e337921656c2f8e2b13bd3c052a0baac1
commands:
- sleep 15
- name: "dockerbuild:"
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
commands:
- set -e
- sh .drone/login.sh
- sh .drone/build.sh
- sh .drone/push.sh
- sh .drone/logout.sh
volumes:
- name: dockersock
path: /var/run
- name: deploy
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
settings:
envs:
- drone_tag
- drone_commit
- drone_build_number
- drone_repo_name
- drone_repo_namespace
- registry_domain
- registry_port
- registry_password
- origin
- smtp_host
- smtp_port
- smtp_username
- smtp_from_address
- forbid_new_owners
- postgres_db
- postgres_user
- github_key
- smtp_password
- askimet_key
- postgres_password
- github_secret
host: ${SSH_HOST}
key: ${SSH_KEY}
passphrase: ${SSH_PASSPHRASE}
port: ${SSH_PORT}
script:
- export SMTP_PASSWORD=$${SMTP_PASSWORD}
- export ASKIMET_KEY=$${ASKIMET_KEY}
- export POSTGRES_PASSWORD=$${POSTGRES_PASSWORD}
- export GITHUB_SECRET=$${GITHUB_SECRET}
- export ORIGIN=$${ORIGIN}
- export SMTP_HOST=$${SMTP_HOST}
- export SMTP_PORT=$${SMTP_PORT}
- export SMTP_USERNAME=$${SMTP_USERNAME}
- export SMTP_FROM_ADDRESS=$${SMTP_FROM_ADDRESS}
- export FORBID_NEW_OWNERS=$${FORBID_NEW_OWNERS}
- export POSTGRES_DB=$${POSTGRES_DB}
- export POSTGRES_USER=$${POSTGRES_USER}
- export GITHUB_KEY=$${GITHUB_KEY}
- export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN}
- export REGISTRY_PORT=$${REGISTRY_PORT}
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD}
- set -e
- cd /stack/commento
- sh .drone/login.sh
- sh .drone/pull.sh
- sh .drone/deploy.sh
username: ${SSH_USER}
environment:
ASKIMET_KEY:
from_secret: askimet-key
FORBID_NEW_OWNERS:
from_secret: forbid-new-owners
GITHUB_KEY:
from_secret: github-key
GITHUB_SECRET:
from_secret: github-secret
ORIGIN:
from_secret: origin
POSTGRES_DB:
from_secret: postgres-db
POSTGRES_PASSWORD:
from_secret: postgres-password
POSTGRES_USER:
from_secret: postgres-user
SMTP_FROM_ADDRESS:
from_secret: smtp-from-address
SMTP_HOST:
from_secret: smtp-host
SMTP_PASSWORD:
from_secret: smtp-password
SMTP_PORT:
from_secret: smtp-port
SMTP_USERNAME:
from_secret: smtp-username
services:
- name: docker
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
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
trigger:
event:
- promote
target:
- production
...