forked from 4paradigm/OpenMLDB
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (67 loc) · 2.18 KB
/
openmldb-docker.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
name: OpenMLDB Docker
on:
push:
branches:
- main
paths:
- .github/workflows/openmldb-docker.yml
- demo/**/*
tags:
- v*
pull_request:
paths:
- .github/workflows/openmldb-docker.yml
- demo/**/*
workflow_dispatch:
inputs:
OPENMLDB_VERSION:
description: 'The openmldb version installed in docker. ex: 0.3.0'
required: true
default: '0.5.0'
env:
IMAGE_NAME: openmldb
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker Compose Test
working-directory: demo
run: |
docker-compose -f docker-compose.test.yml -- up --exit-code-from sut
- name: Decide Push
run: |
if [[ ${{ github.event_name }} = 'workflow_dispatch' ]]; then
echo "PUSH=true" >> $GITHUB_ENV
VERSION=${{ github.event.inputs.OPENMLDB_VERSION }}
DOCKERHUB_TAG=${{ secrets.DOCKERHUB_REPO }}/$IMAGE_NAME:$VERSION
DOCKERHUB_LATEST=${{ secrets.DOCKERHUB_REPO }}/$IMAGE_NAME:latest
echo "DockerHub Tag: $DOCKERHUB_TAG"
echo "COMMIT=${{ github.sha }}"
echo "DOCKERHUB_TAG=$DOCKERHUB_TAG" >> $GITHUB_ENV
echo "DOCKERHUB_LATEST=$DOCKERHUB_LATEST" >> $GITHUB_ENV
else
echo "PUSH=false" >> $GITHUB_ENV
fi
- name: Login to Docker Hub
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build And Push
id: docker_build
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: docker/build-push-action@v3
with:
context: demo
push: ${{ env.PUSH }}
platforms: linux/amd64
tags: |
${{ env.DOCKERHUB_TAG }}
${{ env.DOCKERHUB_LATEST }}
build-args: OPENMLDB_VERSION=${{ github.event.inputs.OPENMLDB_VERSION }}