64 lines
1.2 KiB
YAML
64 lines
1.2 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: default
|
|
|
|
steps:
|
|
|
|
- name: test
|
|
pull: if-not-exists
|
|
image: golang:1.20
|
|
commands:
|
|
- go test ./...
|
|
|
|
- name: build
|
|
pull: if-not-exists
|
|
image: golang:1.20
|
|
commands:
|
|
- GOOS=linux GOARCH=amd64 go build -o butler cmd/butler/main.go
|
|
- touch .env
|
|
- echo TELEGRAM_TOKEN=AAAAAAAA >> .env
|
|
|
|
- name: copy to server
|
|
pull: if-not-exists
|
|
image: appleboy/drone-scp
|
|
settings:
|
|
host:
|
|
from_secret: SSH_IP
|
|
username:
|
|
from_secret: SSH_USER
|
|
key:
|
|
from_secret: SSH_KEY
|
|
port:
|
|
from_secret: SSH_PORT
|
|
target: /home/crab/deploys/butler_bot
|
|
source:
|
|
- .env
|
|
- build/ci/Dockerfile
|
|
- deploy/docker-compose.yml
|
|
- migrations
|
|
rm: true
|
|
|
|
# - name: deploy
|
|
# pull: if-not-exists
|
|
# image: appleboy/drone-ssh
|
|
# settings:
|
|
# host:
|
|
# from_secret: ssh_ip
|
|
# username:
|
|
# from_secret: ssh_user
|
|
# key:
|
|
# from_secret: ssh_key
|
|
# port:
|
|
# from_secret: ssh_port
|
|
# script:
|
|
|
|
# TODO:
|
|
# scp bin, Dockerfile, docker-compose
|
|
# create .env from secrets
|
|
# run migrations
|
|
# restart container
|
|
|
|
trigger:
|
|
event:
|
|
- push
|