65 lines
1.4 KiB
YAML
65 lines
1.4 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: default
|
|
|
|
steps:
|
|
- name: build
|
|
image: golang:1.22
|
|
commands:
|
|
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o cake_crm cmd/cake_crm/main.go
|
|
|
|
- name: test
|
|
image: golang:1.22
|
|
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 ]
|
|
commands:
|
|
- go test ./...
|
|
- echo $${order_bot_token} >> order_bot_token.txt
|
|
- echo $${telegram_order_chat_id} >> telegram_order_chat_id.txt
|
|
|
|
- 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:
|
|
- resources
|
|
- 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
|
|
- docker-compose up -d --build --force-recreate
|
|
|
|
trigger:
|
|
event:
|
|
- push
|
|
|