-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
94 lines (81 loc) · 1.97 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
87
88
89
90
91
92
93
94
---
kind: pipeline
type: docker
name: default
clone:
depth: 1
volumes:
- name: dockersock
host:
path: /var/run/docker.sock
x-docker-step: &docker-step
image: docker
volumes:
- name: dockersock
path: /var/run/docker.sock
environment:
BUILD_TAG: ${DRONE_COMMIT_SHA:0:7}
DOCKER_USERNAME:
from_secret: DOCKER_USERNAME
DOCKER_PASSWORD:
from_secret: DOCKER_PASSWORD
x-docker-auth:
- &docker-auth docker login docker.pkg.github.com -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
steps:
- name: Build docker image
<<: *docker-step
commands:
- docker build -t docker.pkg.github.com/zyra/autonats/autonats:$BUILD_TAG .
- name: Push docker image
<<: *docker-step
commands:
- *docker-auth
- docker push docker.pkg.github.com/zyra/autonats/autonats:$BUILD_TAG
- name: Push latest docker image
<<: *docker-step
when:
branch:
- master
commands:
- *docker-auth
- docker tag docker.pkg.github.com/zyra/autonats/autonats:$BUILD_TAG docker.pkg.github.com/zyra/autonats/autonats:latest
- docker push docker.pkg.github.com/zyra/autonats/autonats:latest
- name: Push version tagged image
<<: *docker-step
when:
event:
- tag
commands:
- *docker-auth
- docker tag docker.pkg.github.com/zyra/autonats/autonats:$BUILD_TAG docker.pkg.github.com/zyra/autonats/autonats:$DRONE_TAG
- docker push docker.pkg.github.com/zyra/autonats/autonats:$DRONE_TAG
- name: Build binaries
image: golang:1.15-alpine
when:
event:
- tag
commands:
- apk add git make upx
- make build -j$(nproc)
- make compress -j$(nproc)
- name: Publish binaries to Github
image: plugins/github-release
when:
event:
- tag
settings:
api_key:
from_secret: github_secret
files:
- bin/autonats_darwin_amd64
- bin/autonats_linux_amd64
- bin/autonats_windows_amd64.exe
checksum:
- md5
- sha1
- sha256
- sha512
---
kind: signature
hmac: 193d9ed4987bc75c271358c134d12b8b0ac17f0403a9607698a30553f770a242
...