2023-08-13 17:34:58 +00:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: default
|
|
|
|
|
|
|
|
steps:
|
2023-08-13 20:10:45 +00:00
|
|
|
|
|
|
|
- name: test
|
2023-08-13 17:45:31 +00:00
|
|
|
pull: if-not-exists
|
2023-08-13 17:39:55 +00:00
|
|
|
image: golang:1.20
|
2023-08-13 17:34:58 +00:00
|
|
|
commands:
|
2023-08-13 20:10:45 +00:00
|
|
|
- go test ./...
|
2023-08-13 17:34:58 +00:00
|
|
|
|
2023-08-13 20:10:45 +00:00
|
|
|
- name: build
|
|
|
|
pull: if-not-exists
|
|
|
|
image: golang:1.20
|
2023-08-13 17:34:58 +00:00
|
|
|
commands:
|
2023-08-13 20:10:45 +00:00
|
|
|
- GOOS=linux GOARCH=amd64 go build -o butler cmd/butler/main.go
|
2023-09-12 16:24:10 +00:00
|
|
|
- touch .env
|
|
|
|
- echo TELEGRAM_TOKEN=AAAAAAAA >> .env
|
|
|
|
|
|
|
|
- name: copy to server
|
|
|
|
pull: if-not-exists
|
|
|
|
image: appleboy/drone-scp
|
|
|
|
settings:
|
|
|
|
host:
|
2023-09-12 16:32:12 +00:00
|
|
|
from_secret: SSH_IP
|
2023-09-12 16:24:10 +00:00
|
|
|
username:
|
2023-09-12 16:32:12 +00:00
|
|
|
from_secret: SSH_USER
|
2023-09-12 16:24:10 +00:00
|
|
|
key:
|
2023-09-12 16:32:12 +00:00
|
|
|
from_secret: SSH_KEY
|
2023-09-12 16:24:10 +00:00
|
|
|
port:
|
2023-09-12 16:32:12 +00:00
|
|
|
from_secret: SSH_PORT
|
2023-09-12 16:24:10 +00:00
|
|
|
target: /home/crab/deploys/butler_bot
|
|
|
|
source:
|
|
|
|
- .env
|
2023-09-12 16:45:44 +00:00
|
|
|
- build/ci/Dockerfile
|
|
|
|
- deploy/docker-compose.yml docker-compose.yml
|
2023-09-12 16:24:10 +00:00
|
|
|
- migrations
|
2023-09-12 16:45:44 +00:00
|
|
|
- cmd
|
2023-09-12 16:24:10 +00:00
|
|
|
rm: true
|
|
|
|
|
|
|
|
# - name: deploy
|
|
|
|
# pull: if-not-exists
|
|
|
|
# image: appleboy/drone-ssh
|
|
|
|
# settings:
|
|
|
|
# host:
|
2023-09-12 16:39:17 +00:00
|
|
|
# from_secret: SSH_IP
|
2023-09-12 16:24:10 +00:00
|
|
|
# username:
|
2023-09-12 16:39:17 +00:00
|
|
|
# from_secret: SSH_USER
|
2023-09-12 16:24:10 +00:00
|
|
|
# key:
|
2023-09-12 16:39:17 +00:00
|
|
|
# from_secret: SSH_KEY
|
2023-09-12 16:24:10 +00:00
|
|
|
# port:
|
2023-09-12 16:39:17 +00:00
|
|
|
# from_secret: SSH_PORT
|
2023-09-12 16:24:10 +00:00
|
|
|
# script:
|
2023-08-13 20:10:45 +00:00
|
|
|
|
|
|
|
# TODO:
|
|
|
|
# scp bin, Dockerfile, docker-compose
|
|
|
|
# create .env from secrets
|
|
|
|
# run migrations
|
|
|
|
# restart container
|
2023-08-13 17:34:58 +00:00
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- push
|