-
Notifications
You must be signed in to change notification settings - Fork 19
39 lines (35 loc) · 1.23 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
name: Docker Image CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
- name: Check if secrets exist
id: check_secrets
run: |
if [ -z "${{ secrets.DOCKERHUB_USERNAME }}" ] || [ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]; then
echo "Secrets do not exist"
echo "push_image=false" >> $GITHUB_ENV
else
echo "Secrets exist"
echo "push_image=true" >> $GITHUB_ENV
fi
- name: Build and Push Docker Image
uses: ./.github/actions/docker-build
with:
dockerfile: "dockerfile"
image_tag: "gretelxai/gretel:dev-latest"
push_image: ${{ github.event_name == 'push' && env.push_image == 'true' }}
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_TOKEN }}