Skip to content

Commit 8bba806

Browse files
authored
Create jaeger-dockerimage.yml (#8)
Signed-off-by: Annanay <annanayagarwal@gmail.com>
1 parent 622bf3e commit 8bba806

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Docker Image
2+
on:
3+
push:
4+
tags:
5+
- '**'
6+
branches:
7+
- master
8+
pull_request:
9+
paths:
10+
- .github/workflows/jaeger-dockerimage.yml
11+
- Dockerfile
12+
- protoc-wrapper
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v1
19+
- name: Build the Docker image
20+
run: docker build .
21+
- name: Push the Docker image
22+
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
23+
run: |
24+
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
25+
26+
function tag_and_push {
27+
docker tag build "jaegertracing/protobuf:${1}" && docker push "jaegertracing/protobuf:${1}"
28+
}
29+
30+
if [[ "${GITHUB_REF}" == "refs/heads/master" ]]; then
31+
tag_and_push "latest"
32+
elif [[ "${GITHUB_REF}" =~ refs/tags/v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
33+
TAG="${GITHUB_REF#"refs/tags/v"}"
34+
tag_and_push "${TAG}"
35+
if [[ "${TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
36+
tag_and_push "${TAG%.*}"
37+
tag_and_push "${TAG%.*.*}";
38+
tag_and_push "latest"
39+
fi
40+
else
41+
tag_and_push "${GITHUB_REF#"refs/tags/"}"
42+
fi

0 commit comments

Comments
 (0)