2024-05-19 10:02:50 +00:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: default
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: build
|
2024-05-20 22:10:01 +00:00
|
|
|
image: golang:1.22
|
2024-05-19 10:02:50 +00:00
|
|
|
commands:
|
2024-05-20 22:13:04 +00:00
|
|
|
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o cake_crm cmd/cake_crm/main.go
|
2024-05-19 10:02:50 +00:00
|
|
|
|
|
|
|
- name: test
|
2024-05-20 22:10:01 +00:00
|
|
|
image: golang:1.22
|
2024-05-23 18:32:49 +00:00
|
|
|
environment:
|
|
|
|
order_bot_token:
|
|
|
|
from_secret: order_bot_token
|
|
|
|
telegram_order_chat_id:
|
|
|
|
from_secret: telegram_order_chat_id
|
|
|
|
settings:
|
|
|
|
envs: [ order_bot_token, telegram_order_chat_id ]
|
2024-05-19 10:02:50 +00:00
|
|
|
commands:
|
2024-05-19 10:16:32 +00:00
|
|
|
- go test ./...
|
2024-05-23 18:32:49 +00:00
|
|
|
- echo $${order_bot_token} >> order_bot_token.txt
|
|
|
|
- echo $${telegram_order_chat_id} >> telegram_order_chat_id.txt
|
2024-05-19 10:02:50 +00:00
|
|
|
|
|
|
|
- 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/cake_crm
|
|
|
|
source:
|
2024-05-21 17:17:56 +00:00
|
|
|
- resources
|
2024-05-23 18:46:08 +00:00
|
|
|
- telegram_order_chat_id.txt
|
|
|
|
- order_bot_token.txt
|
2024-05-19 10:02:50 +00:00
|
|
|
- cake_crm
|
|
|
|
- docker-compose.yml
|
|
|
|
- Dockerfile
|
|
|
|
rm: true
|
|
|
|
|
|
|
|
- name: deploy
|
|
|
|
image: appleboy/drone-ssh
|
|
|
|
settings:
|
|
|
|
host:
|
|
|
|
from_secret: server_ip
|
|
|
|
username:
|
|
|
|
from_secret: ssh_user
|
|
|
|
key:
|
|
|
|
from_secret: ssh_key
|
|
|
|
port:
|
|
|
|
from_secret: ssh_port
|
|
|
|
command_timeout: 10s
|
|
|
|
script:
|
|
|
|
- cd deploys/cake_crm
|
2024-05-23 18:46:08 +00:00
|
|
|
- mv order_bot_token.txt resources
|
|
|
|
- mv telegram_order_chat_id.txt resources
|
2024-05-20 21:59:42 +00:00
|
|
|
- docker-compose up -d --build --force-recreate
|
2024-05-19 10:02:50 +00:00
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- push
|
2024-05-23 18:18:23 +00:00
|
|
|
|