-
Notifications
You must be signed in to change notification settings - Fork 35
91 lines (80 loc) · 2.81 KB
/
build-and-publish.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
name: Docker Image
on:
push:
branches: [main]
pull_request:
branches: [main]
paths:
- .github/workflows/jaeger-dockerimage.yml
- Dockerfile
- protoc-wrapper
release:
types: [published]
# allow running release workflow manually
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true
- name: Extract tags/labels from Git
id: docker_meta
uses: docker/metadata-action@v5
with:
images: jaegertracing/protobuf
# The 'tags:' section defines how the Docker image will be tagged:
# - pushes to main branch will be published as 'latest'
# - pushes tagged with semver will be published as that version (without 'v')
# - other tags can be used as is
# Documentation: https://github.com/docker/metadata-action#tags-input
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=semver,pattern={{version}}
type=ref,event=tag
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and maybe push Docker image
uses: docker/build-push-action@v5
with:
push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
# The following steps run only on pull requests and validate
# that the new image can run successfully in Jaeger repos.
# We do not check if the generated files would be different there,
# only that the build does not fail.
- name: Checkout Jaeger for validation
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
repository: jaegertracing/jaeger
submodules: recursive
path: jaeger
- name: Build Proto in Jaeger
if: github.event_name == 'pull_request'
working-directory: jaeger
run: make proto JAEGER_DOCKER_PROTOBUF=protobuf
- name: Checkout jaeger-idl for validation
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
repository: jaegertracing/jaeger-idl
submodules: recursive
path: jaeger-idl
- name: Build Proto in jaeger-idl
if: github.event_name == 'pull_request'
working-directory: jaeger-idl
run: make proto PROTOC_IMAGE=protobuf