drone-ci-golang/.drone.yml

40 lines
908 B
YAML
Raw Normal View History

2020-01-07 08:56:43 +08:00
kind: pipeline
name: default
steps:
2020-01-07 10:21:59 +08:00
- name: 执行代码检查
2020-01-07 08:56:43 +08:00
image: golang:latest
commands:
- go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
- golangci-lint run
2020-01-07 10:21:59 +08:00
- name: 编译x86_64平台二进制文件
2020-01-07 08:56:43 +08:00
image: golang:latest
environment:
GOOS: linux
GOARCH: amd64
CGO_ENABLED: 0
commands:
2020-01-07 10:21:59 +08:00
- go build -o go-app
2020-01-07 08:56:43 +08:00
2020-01-07 10:21:59 +08:00
- name: 打包Docker镜像并推送
2020-01-07 08:56:43 +08:00
image: plugins/docker
settings:
registry: docker.gitee.ltd
repo: docker.gitee.ltd/lxh/golang-demo
use_cache: true
username: docker
password: dockeruser
tags:
- latest
- 0.0.1
when:
event: push
2020-01-07 10:21:59 +08:00
branch: master
- name: 发送电报通知消息
image: appleboy/drone-telegram
settings:
token: 883905265:AAFv3NAH4ykdh2m_XiQUuyKNJ9XE5RV7ukU
to: 365042238
message: 项目构建成功