-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.drone.yml
77 lines (70 loc) · 1.72 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
kind: pipeline
type: docker
name: default
steps:
- name: Go lint
image: golangci/golangci-lint:v1.49-alpine
environment:
GOLANGCI_LINT_CACHE: "/drone/src/.cache/golangci-lint"
commands:
- golangci-lint cache status
- golangci-lint run --timeout 3m0s
when:
branch:
exclude:
- "master"
- "*stable"
- name: Rebuild lint cache
pull: if-not-exists
image: drillster/drone-volume-cache
volumes:
- name: golint-cache
path: /golint-cache
settings:
rebuild: true
mount:
- .cache/golangci-lint
when:
branch:
exclude:
- "master"
- "*stable"
- name: Bump and tag
image: golang:1.18
environment:
GITHUB_API_KEY:
from_secret: gh_api_key
GITHUB_API_USER:
from_secret: gh_api_user
commands:
- go install github.com/guilhem/[email protected]
- git remote add authenticated-origin https://$GITHUB_API_USER:[email protected]/$DRONE_REPO
- git fetch --tags authenticated-origin
- bump patch --allow-dirty
- git push authenticated-origin --tags
when:
branch:
- master
trigger:
event:
- push
---
kind: pipeline
type: docker
name: publish
steps:
- name: Build and publish
image: golang:1.18
environment:
GO111MODULE: on
GITHUB_API_KEY:
from_secret: gh_api_key
commands:
- echo $DRONE_TAG | grep -v / || exit 78 # Skip if submodule is tagged
- go mod download
- make build
- go install github.com/tcnksm/[email protected]
- ghr -t $GITHUB_API_KEY -u ${DRONE_REPO_NAMESPACE} -r ${DRONE_REPO_NAME} -c ${DRONE_COMMIT} -delete ${DRONE_TAG} ./bin
trigger:
event:
- tag