forked from zilliztech/milvus-cdc
-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (33 loc) · 1.18 KB
/
image_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
name: Build and Push Docker image
on:
push:
branches:
- main
pull_request:
branches:
- main
types: [closed]
jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true || github.event_name == 'push'
steps:
- uses: actions/checkout@v3
- run: git fetch --force --tags
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Docker Login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push docker image
run: |
bash build_image.sh
BRANCH=$(git symbolic-ref --short HEAD)
COMMIT_ID=$(git rev-parse --short HEAD)
docker tag milvus-cdc:${BRANCH}-${COMMIT_ID} ${{ secrets.DOCKER_USER }}/milvus-cdc:${BRANCH}-${COMMIT_ID}
docker push ${{ secrets.DOCKER_USER }}/milvus-cdc:${BRANCH}-${COMMIT_ID}
docker tag milvus-cdc:${BRANCH}-${COMMIT_ID} ${{ secrets.DOCKER_USER }}/milvus-cdc:${BRANCH}-latest
docker push ${{ secrets.DOCKER_USER }}/milvus-cdc:${BRANCH}-latest