valera/.drone.yml

61 lines
1.2 KiB
YAML

kind: pipeline
type: docker
name: default
steps:
- name: build
image: golang
commands:
- go test
- go build -o valera_tg_bot main.go
- name: scp
image: appleboy/drone-scp
settings:
host:
from_secret: server_ip
username:
from_secret: ssh_user
key:
from_secret: ssh_key
port:
from_secret: ssh_port
target:
- deploys/valera_tg_bot
source:
- valera_tg_bot
rm: true
- name: deploy
image: appleboy/drone-ssh
environment:
TOKEN:
from_secret: bot_token
MONGO_URL:
from_secret: mongo_url
DB_NAME:
from_secret: db_name
PASSWORD:
from_secret: ssh_pass
settings:
host:
from_secret: server_ip
username:
from_secret: ssh_user
key:
from_secret: ssh_key
port:
from_secret: ssh_port
envs: [ TOKEN,MONGO_URL,DB_NAME,PASSWORD ]
command_timeout: 10s
script:
- cd deploys/valera_tg_bot
- echo $${TOKEN} > token.txt
- echo $${MONGO_URL} > mongo_url.txt
- echo $${DB_NAME} > "db_name.txt"
- echo $${PASSWORD} | sudo -S systemctl restart valera
trigger:
event:
- push