65 lines
1.3 KiB
YAML
65 lines
1.3 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: default
|
|
|
|
steps:
|
|
- name: build
|
|
image: golang:1.23
|
|
commands:
|
|
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o smm_core cmd/smm_core/main.go
|
|
|
|
- name: test
|
|
image: golang:1.23
|
|
commands:
|
|
- go test ./...
|
|
|
|
- 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/smm_core
|
|
source:
|
|
- resources
|
|
- smm_core
|
|
- docker-compose.yml
|
|
- Dockerfile
|
|
- migrations
|
|
rm: true
|
|
|
|
- name: deploy
|
|
image: appleboy/drone-ssh
|
|
environment:
|
|
DB_PASS:
|
|
from_secret: db_pass
|
|
settings:
|
|
host:
|
|
from_secret: server_ip
|
|
username:
|
|
from_secret: ssh_user
|
|
key:
|
|
from_secret: ssh_key
|
|
port:
|
|
from_secret: ssh_port
|
|
command_timeout: 50s
|
|
script:
|
|
- cd deploys/smm_core
|
|
- export PATH=$PATH:/usr/local/go/bin:/$HOME/go/bin
|
|
- goose -allow-missing -dir ./migrations postgres "user=crab password=$${DB_PASS} dbname=smm-core host=localhost port=5432 sslmode=disable" up
|
|
- docker-compose up -d --build --force-recreate
|
|
|
|
trigger:
|
|
branch:
|
|
- master
|
|
event:
|
|
- push
|
|
- tag
|
|
|