-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.drone.yml
86 lines (84 loc) · 1.87 KB
/
.drone.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
kind: pipeline
type: vm
name: default
pool:
use: ubuntu
steps:
- name: build
image: golang:1.18
commands:
- go build
- name: go vet and unit tests
image: golang:1
commands:
- go vet ./...
- go test -cover ./...
volumes:
- name: cache
path: /root/.cache/go-build
depends_on:
- build
- name: check go.mod is up to date
image: golang:1.18
commands:
- cp go.mod go.mod.bak
- go mod tidy
- diff go.mod go.mod.bak || (echo "go.mod is not up to date" && exit 1)
volumes:
- name: cache
path: /root/.cache/go-build
depends_on:
- build
- name: golangci-lint
image: golangci/golangci-lint
commands:
- golangci-lint run --timeout 500s
volumes:
- name: cache
path: /root/.cache/go-build
depends_on:
- build
- name: build binaries
image: golang:1.18
commands:
- sh scripts/build.sh
depends_on:
- go vet and unit tests
- check go.mod is up to date
- golangci-lint
when:
ref:
- refs/heads/main
- refs/tags/*
- name: publish binaries to github
image: plugins/github-release
settings:
files:
- release/linux-amd64-plugin
- release/linux-arm64-plugin
- release/darwin-amd64-plugin
- release/darwin-arm64-plugin
- release/plugin.exe
api_key:
from_secret: github_token
depends_on:
- build binaries
when:
ref:
- refs/tags/*
- name: publish to docker hub
image: plugins/docker
settings:
repo: tphoney/best_practice
auto_tag: true
dockerfile: docker/Dockerfile
username:
from_secret: docker_username
password:
from_secret: docker_password
depends_on:
- build binaries
when:
ref:
- refs/heads/main
- refs/tags/*