Skip to content

Commit c7e8f9f

Browse files
committed
Build and push Docker vitess/vttestserver DockerHub from GitHub Actions (vitessio#14314)
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
1 parent 9379665 commit c7e8f9f

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Docker Build vttestserver
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags:
7+
- '*'
8+
9+
concurrency:
10+
group: format('{0}-{1}', ${{ github.ref }}, 'Docker Build vttestserver')
11+
cancel-in-progress: true
12+
13+
permissions: read-all
14+
15+
jobs:
16+
build_and_push:
17+
name: Build and push vitess/vttestserver Docker images
18+
runs-on: gh-hosted-runners-16cores-1
19+
if: github.repository == 'vitessio/vitess'
20+
21+
strategy:
22+
fail-fast: true
23+
matrix:
24+
branch: [ mysql57, mysql80 ]
25+
26+
steps:
27+
- name: Check out code
28+
uses: actions/checkout@v3
29+
30+
- name: Login to Docker Hub
31+
uses: docker/login-action@v3
32+
with:
33+
username: ${{ secrets.DOCKERHUB_USERNAME }}
34+
password: ${{ secrets.DOCKERHUB_TOKEN }}
35+
36+
- name: Set Dockerfile path
37+
run: |
38+
echo "DOCKERFILE=./docker/vttestserver/Dockerfile.${{ matrix.branch }}" >> $GITHUB_ENV
39+
40+
- name: Build and push on main
41+
if: github.ref == 'refs/heads/main'
42+
uses: docker/build-push-action@v5
43+
with:
44+
context: .
45+
file: ${{ env.DOCKERFILE }}
46+
push: true
47+
tags: vitess/vttestserver:${{ matrix.branch }}
48+
49+
- name: Get the Git tag
50+
if: startsWith(github.ref, 'refs/tags/')
51+
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
52+
53+
- name: Set Docker tag name
54+
if: startsWith(github.ref, 'refs/tags/')
55+
run: |
56+
echo "DOCKER_TAG=vitess/vttestserver:${TAG_NAME}-${{ matrix.branch }}" >> $GITHUB_ENV
57+
58+
- name: Build and push on tags
59+
if: startsWith(github.ref, 'refs/tags/')
60+
uses: docker/build-push-action@v5
61+
with:
62+
context: .
63+
file: ${{ env.DOCKERFILE }}
64+
push: true
65+
tags: ${{ env.DOCKER_TAG }}

0 commit comments

Comments
 (0)