-
Notifications
You must be signed in to change notification settings - Fork 54
114 lines (94 loc) · 4.72 KB
/
docker-build.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Build
on:
workflow_call:
inputs:
IMAGE_TAG:
description: "Kafka connector version"
required: true
type: string
default: "latest"
secrets:
DOCKERHUB_USERNAME:
required: false
DOCKERHUB_TOKEN:
required: false
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
IMAGE_TAG: ${{ inputs.IMAGE_TAG }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Login to Docker Hub
uses: docker/login-action@v2
if: ${{ env.DOCKERHUB_USERNAME != '' }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Update Kafka version
working-directory: sink-connector
if: ${{ github.event_name == 'release' }}
run: mvn -B versions:set -DnewVersion=${{ github.event.release.tag_name }} -DgenerateBackupPoms=false
- name: Update Lightweight version
working-directory: sink-connector-lightweight
if: ${{ github.event_name == 'release' }}
run: mvn -B versions:set -DnewVersion=${{ github.event.release.tag_name }} -DgenerateBackupPoms=false
- name: Setup env
working-directory: sink-connector
run: echo "PROJECT_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> "$GITHUB_ENV"
- name: Build with Maven (Kafka)
working-directory: sink-connector
run: mvn -B package install -DskipTests=true --file pom.xml
- name: Upload Maven build (Kafka)
uses: actions/upload-artifact@v3
with:
name: clickhouse-sink-connector-kafka-${{ env.IMAGE_TAG }}.jar
path: sink-connector/target/clickhouse-kafka-sink-connector-${{ env.PROJECT_VERSION }}.jar
- name: Build Docker image (Kafka)
working-directory: sink-connector
run: |
docker build . --file docker/Dockerfile-sink-on-debezium-base-image --tag altinityinfra/clickhouse-sink-connector:${{ env.IMAGE_TAG }}-kafka
docker save altinityinfra/clickhouse-sink-connector:${{ env.IMAGE_TAG }}-kafka | gzip > clickhouse-sink-connector_${{ env.IMAGE_TAG }}-kafka.tar.gz
- name: Upload Docker tar (Kafka)
uses: actions/upload-artifact@v3
if: ${{ github.event.pull_request.head.repo.full_name != 'Altinity/clickhouse-sink-connector' && github.event_name != 'workflow_dispatch' }}
with:
name: clickhouse-sink-connector_${{ env.IMAGE_TAG }}-kafka.tar.gz
path: sink-connector/clickhouse-sink-connector_${{ env.IMAGE_TAG }}-kafka.tar.gz
- name: Upload Docker image (Kafka)
if: ${{ env.DOCKERHUB_USERNAME != '' }}
run: docker image push altinityinfra/clickhouse-sink-connector:${{ env.IMAGE_TAG }}-kafka
- name: Update sink connector jar file version in sink-connector-lightweight pom.xml
working-directory: sink-connector-lightweight
run: mvn versions:set-property -Dproperty=sink-connector-library-version -DnewVersion=${{ env.PROJECT_VERSION }}
- name: Build with Maven (Lightweight)
working-directory: sink-connector-lightweight
run: mvn -B package -DskipTests=true --file pom.xml
- name: Upload Maven build (Lightweight)
uses: actions/upload-artifact@v3
with:
name: clickhouse-sink-connector-lt-${{ env.IMAGE_TAG }}.jar
path: sink-connector-lightweight/target/clickhouse-debezium-embedded-${{ env.PROJECT_VERSION }}.jar
- name: Build with Go
working-directory: sink-connector-client
run: CGO_ENABLED=0 go build
- name: Build Docker image (Lightweight)
run: |
docker build . --file sink-connector-lightweight/Dockerfile --build-arg DOCKER_TAG=${{ env.IMAGE_TAG }} --tag altinityinfra/clickhouse-sink-connector:${{ env.IMAGE_TAG }}-lt
docker save altinityinfra/clickhouse-sink-connector:${{ env.IMAGE_TAG }}-lt | gzip > clickhouse-sink-connector_${{ env.IMAGE_TAG }}-lt.tar.gz
- name: Upload Docker tar (Lightweight)
uses: actions/upload-artifact@v3
if: ${{ github.event.pull_request.head.repo.full_name != 'Altinity/clickhouse-sink-connector' && github.event_name != 'workflow_dispatch' }}
with:
name: clickhouse-sink-connector_${{ env.IMAGE_TAG }}-lt.tar.gz
path: clickhouse-sink-connector_${{ env.IMAGE_TAG }}-lt.tar.gz
- name: Upload Docker image (Lightweight)
if: ${{ env.DOCKERHUB_USERNAME != '' }}
run: docker image push altinityinfra/clickhouse-sink-connector:${{ env.IMAGE_TAG }}-lt