Skip to content

Commit 1e802f1

Browse files
committed
add dockerhub as a job
Signed-off-by: mahdikhashan <[email protected]>
1 parent 82d0163 commit 1e802f1

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

.github/workflows/build-and-publish-images.yaml

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ on:
1515
type: string
1616

1717
jobs:
18-
build-and-publish:
19-
name: Publish Image
18+
build-and-publish-to-ghcr:
19+
name: Publish Image to Github Container Registry
2020
runs-on: ubuntu-22.04
2121
steps:
2222
- name: Checkout
@@ -54,3 +54,41 @@ jobs:
5454
dockerfile: ${{ inputs.dockerfile }}
5555
platforms: ${{ inputs.platforms }}
5656
push: false
57+
58+
build-and-publish-to-dockerhub:
59+
name: Publish Image to DockerHub
60+
runs-on: ubuntu-22.04
61+
steps:
62+
- name: Checkout
63+
uses: actions/checkout@v4
64+
65+
- name: DockerHub Login
66+
if: >-
67+
github.repository == 'kubeflow/katib' &&
68+
(github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/v'))
69+
uses: docker/login-action@v3
70+
with:
71+
registry: docker.io
72+
username: ${{ secrets.DOCKERHUB_USERNAME }}
73+
password: ${{ secrets.DOCKERHUB_TOKEN }}
74+
75+
- name: Publish Component ${{ inputs.component-name }}
76+
if: >-
77+
github.repository == 'kubeflow/katib' &&
78+
(github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/v'))
79+
id: publish
80+
uses: ./.github/workflows/template-publish-image
81+
with:
82+
image: docker.io/kubeflow/katib/${{ inputs.component-name }}
83+
dockerfile: ${{ inputs.dockerfile }}
84+
platforms: ${{ inputs.platforms }}
85+
push: true
86+
87+
- name: Test Build For Component ${{ inputs.component-name }}
88+
if: steps.publish.outcome == 'skipped'
89+
uses: ./.github/workflows/template-publish-image
90+
with:
91+
image: ghcr.io/kubeflow/katib/${{ inputs.component-name }}
92+
dockerfile: ${{ inputs.dockerfile }}
93+
platforms: ${{ inputs.platforms }}
94+
push: false

0 commit comments

Comments
 (0)