-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
92 lines (77 loc) · 1.94 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
---
kind: pipeline
type: docker
name: build
volumes:
- name: dockersocket
host:
path: /var/run/docker.sock
steps:
- name: docker
image: livingdocs/docker-node
volumes:
- name: dockersocket
path: /var/run/docker.sock
environment:
DOCKER_USERNAME:
from_secret: DOCKER_USERNAME
DOCKER_PASSWORD:
from_secret: DOCKER_PASSWORD
commands:
- |
SHA_TAG=livingdocs/backport:sha-$DRONE_COMMIT_SHA
BRANCH_TAG=livingdocs/backport:branch-$(echo $DRONE_BRANCH | sed 's/[^a-zA-Z0-9.-]/-/g')
docker-login
docker build -t $SHA_TAG -t $BRANCH_TAG .
docker push $SHA_TAG
docker push $BRANCH_TAG
echo -----------------
echo Docker Tag: $SHA_TAG
echo Docker Branch Tag: $BRANCH_TAG
echo -----------------
- name: release
image: livingdocs/semantic-release:v1.2.2
environment:
GH_TOKEN:
from_secret: GH_TOKEN
trigger:
event: [push]
---
kind: pipeline
type: docker
name: tag
volumes:
- name: dockersocket
host:
path: /var/run/docker.sock
steps:
- name: docker
image: livingdocs/docker-node
volumes:
- name: dockersocket
path: /var/run/docker.sock
environment:
DOCKER_USERNAME:
from_secret: DOCKER_USERNAME
DOCKER_PASSWORD:
from_secret: DOCKER_PASSWORD
commands:
- |
SHA_TAG=livingdocs/backport:sha-$DRONE_COMMIT_SHA
RELEASE_TAG=livingdocs/backport:$DRONE_TAG
docker-login
docker build -t $RELEASE_TAG . -f-<<EOF
FROM $SHA_TAG
RUN node -e 'const pkg = require("./package.json"); pkg.version = "$DRONE_TAG".replace(/^v/, ""); fs.writeFileSync("./package.json", JSON.stringify(pkg, null, 2));'
EOF
docker push $RELEASE_TAG
echo -----------------
echo Docker Tag: $SHA_TAG
echo Docker Branch Tag: $RELEASE_TAG
echo -----------------
trigger:
event: [tag]
---
kind: signature
hmac: 27cb0a39b2d0311882a713ec415f535a9d5707c85ac30de04f0b12b90eba49d7
...