|
1 | 1 | # Reusable workflows for publishing Katib images.
|
2 |
| -name: Build And Publish Images |
| 2 | +name: Build and Publish Images |
3 | 3 |
|
4 | 4 | on:
|
5 | 5 | workflow_call:
|
|
21 | 21 |
|
22 | 22 | jobs:
|
23 | 23 | build-and-publish:
|
24 |
| - name: Publish Image |
| 24 | + name: Build and Publish Images |
25 | 25 | runs-on: ubuntu-22.04
|
| 26 | + |
26 | 27 | steps:
|
27 | 28 | - name: Checkout
|
28 | 29 | uses: actions/checkout@v4
|
29 | 30 |
|
30 |
| - - name: Docker Login |
31 |
| - # Trigger workflow only for kubeflow/katib repository with specific branch (master, release-.*) or tag (v.*). |
32 |
| - if: >- |
33 |
| - github.repository == 'kubeflow/katib' && |
34 |
| - (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/v')) |
| 31 | + - name: Set Publish Condition |
| 32 | + id: publish-condition |
| 33 | + shell: bash |
| 34 | + run: | |
| 35 | + if [[ "${{ github.repository }}" == 'kubeflow/katib' && \ |
| 36 | + ( "${{ github.ref }}" == 'refs/heads/master' || \ |
| 37 | + "${{ github.ref }}" =~ ^refs/heads/release- || \ |
| 38 | + "${{ github.ref }}" =~ ^refs/tags/v ) ]]; then |
| 39 | + echo "should_publish=true" >> $GITHUB_OUTPUT |
| 40 | + else |
| 41 | + echo "should_publish=false" >> $GITHUB_OUTPUT |
| 42 | + fi |
| 43 | +
|
| 44 | + - name: GHCR Login |
| 45 | + if: steps.publish-condition.outputs.should_publish == 'true' |
| 46 | + uses: docker/login-action@v3 |
| 47 | + with: |
| 48 | + registry: ghcr.io |
| 49 | + username: ${{ github.actor }} |
| 50 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + |
| 52 | + - name: DockerHub Login |
| 53 | + if: steps.publish-condition.outputs.should_publish == 'true' |
35 | 54 | uses: docker/login-action@v3
|
36 | 55 | with:
|
| 56 | + registry: docker.io |
37 | 57 | username: ${{ secrets.DOCKERHUB_USERNAME }}
|
38 | 58 | password: ${{ secrets.DOCKERHUB_TOKEN }}
|
39 | 59 |
|
40 | 60 | - name: Publish Component ${{ inputs.component-name }}
|
41 |
| - # Trigger workflow only for kubeflow/katib repository with specific branch (master, release-.*) or tag (v.*). |
42 |
| - if: >- |
43 |
| - github.repository == 'kubeflow/katib' && |
44 |
| - (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/v')) |
| 61 | + if: steps.publish-condition.outputs.should_publish == 'true' |
45 | 62 | id: publish
|
46 | 63 | uses: ./.github/workflows/template-publish-image
|
47 | 64 | with:
|
48 |
| - image: docker.io/kubeflowkatib/${{ inputs.component-name }} |
| 65 | + image: | |
| 66 | + ghcr.io/kubeflow/katib/${{ inputs.component-name }} |
| 67 | + docker.io/kubeflowkatib/${{ inputs.component-name }} |
49 | 68 | dockerfile: ${{ inputs.dockerfile }}
|
50 | 69 | platforms: ${{ inputs.platforms }}
|
51 | 70 | push: true
|
|
54 | 73 | if: steps.publish.outcome == 'skipped'
|
55 | 74 | uses: ./.github/workflows/template-publish-image
|
56 | 75 | with:
|
57 |
| - image: docker.io/kubeflowkatib/${{ inputs.component-name }} |
| 76 | + image: | |
| 77 | + ghcr.io/kubeflow/katib/${{ inputs.component-name }} |
| 78 | + docker.io/kubeflowkatib/${{ inputs.component-name }} |
58 | 79 | dockerfile: ${{ inputs.dockerfile }}
|
59 | 80 | platforms: ${{ inputs.platforms }}
|
60 | 81 | push: false
|
0 commit comments