forked from apache/gravitino
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (75 loc) · 2.96 KB
/
docker-image.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
name: Publish Docker Image
on:
workflow_dispatch:
inputs:
image:
type: choice
description: 'Choose the image to build'
required: true
default: 'gravitino'
options:
- 'gravitino'
- 'gravitino-ci-hive'
- 'gravitino-ci-trino'
- 'gravitino-ci-doris'
- 'trino'
- 'hive'
tag:
description: 'Docker tag to apply to this image'
required: true
type: string
token:
description: 'Publish Docker token'
required: true
type: string
jobs:
publish-docker-image:
runs-on: ubuntu-latest
timeout-minutes: 120
env:
input_token: ${{ github.event.inputs.token }}
secrets_token: ${{ secrets.PUBLISH_DOCKER_TOKEN }}
steps:
- name: Set environment variables
run: |
if [ "${{ github.event.inputs.image }}" == "gravitino-ci-hive" ]; then
echo "image_type=hive" >> $GITHUB_ENV
echo "image_name=datastrato/gravitino-ci-hive" >> $GITHUB_ENV
elif [ "${{ github.event.inputs.image }}" == "gravitino-ci-trino" ]; then
echo "image_type=trino" >> $GITHUB_ENV
echo "image_name=datastrato/gravitino-ci-trino" >> $GITHUB_ENV
elif [ "${{ github.event.inputs.image }}" == "gravitino-ci-doris" ]; then
echo "image_type=doris" >> $GITHUB_ENV
echo "image_name=datastrato/gravitino-ci-doris" >> $GITHUB_ENV
elif [ "${{ github.event.inputs.image }}" == "gravitino" ]; then
echo "image_type=gravitino" >> $GITHUB_ENV
echo "image_name=datastrato/gravitino" >> $GITHUB_ENV
elif [ "${{ github.event.inputs.image }}" == "trino" ]; then
echo "image_type=trino" >> $GITHUB_ENV
echo "image_name=datastrato/trino" >> $GITHUB_ENV
elif [ "${{ github.event.inputs.image }}" == "hive" ]; then
echo "image_type=hive" >> $GITHUB_ENV
echo "image_name=datastrato/hive" >> $GITHUB_ENV
fi
- name: Check publish Docker token
run: |
if [[ "${secrets_token}" != "${input_token}" ]]; then
echo "You have entered an incorrect token. Please re-enter it."
exit 1
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: datastrato
password: ${{ secrets.DOCKER_REPOSITORY_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
- name: Build and Push the Docker image
run: sudo rm -rf /usr/local/lib/android && sudo rm -rf /opt/hostedtoolcache/CodeQL && ./dev/docker/build-docker.sh --platform all --type ${image_type} --image ${image_name} --tag ${{ github.event.inputs.tag }} --latest