2023-03-11 08:35:23 +00:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: default
|
|
|
|
|
|
|
|
steps:
|
2023-03-11 08:43:10 +00:00
|
|
|
- name: build
|
|
|
|
image: golang
|
|
|
|
commands:
|
|
|
|
- go build -o valera_tg_bot main.go
|
2023-03-11 08:35:23 +00:00
|
|
|
|
2023-03-18 07:39:02 +00:00
|
|
|
- name: test
|
|
|
|
image: golang
|
|
|
|
commands:
|
|
|
|
- go test
|
|
|
|
|
2023-03-11 08:35:23 +00:00
|
|
|
- name: scp
|
2023-03-11 08:43:10 +00:00
|
|
|
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
|
2023-03-11 08:35:23 +00:00
|
|
|
|
|
|
|
- name: deploy
|
2023-03-11 08:43:10 +00:00
|
|
|
image: appleboy/drone-ssh
|
|
|
|
environment:
|
|
|
|
TOKEN:
|
|
|
|
from_secret: bot_token
|
2023-03-12 19:38:48 +00:00
|
|
|
MONGO_URL:
|
|
|
|
from_secret: mongo_url
|
|
|
|
DB_NAME:
|
|
|
|
from_secret: db_name
|
2023-03-11 08:43:10 +00:00
|
|
|
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
|
2023-03-12 19:38:48 +00:00
|
|
|
envs: [ TOKEN,MONGO_URL,DB_NAME,PASSWORD ]
|
2023-03-11 08:43:10 +00:00
|
|
|
command_timeout: 10s
|
|
|
|
script:
|
|
|
|
- cd deploys/valera_tg_bot
|
2023-03-11 08:35:23 +00:00
|
|
|
- echo $${TOKEN} > token.txt
|
2023-03-12 19:38:48 +00:00
|
|
|
- echo $${MONGO_URL} > mongo_url.txt
|
|
|
|
- echo $${DB_NAME} > "db_name.txt"
|
2023-03-11 08:35:23 +00:00
|
|
|
- echo $${PASSWORD} | sudo -S systemctl restart valera
|
|
|
|
|
|
|
|
trigger:
|
2023-03-11 08:43:10 +00:00
|
|
|
event:
|
|
|
|
- push
|