File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments