github.com/kubeflow/training-operator@v1.7.0/.github/workflows/build-and-publish-images.yaml (about) 1 # Reusable workflows for publishing Training Operator images. 2 name: Build And Publish Images 3 4 on: 5 workflow_call: 6 inputs: 7 component-name: 8 required: true 9 type: string 10 platforms: 11 required: true 12 type: string 13 dockerfile: 14 required: true 15 type: string 16 secrets: 17 DOCKERHUB_USERNAME: 18 required: false 19 DOCKERHUB_TOKEN: 20 required: false 21 22 jobs: 23 build-and-publish: 24 name: Publish Image 25 runs-on: ubuntu-latest 26 steps: 27 - name: Checkout 28 uses: actions/checkout@v3 29 30 - name: Docker Login 31 # Trigger workflow only for kubeflow/training-operator repository with specific branch (master, v.*-branch) or tag (v.*). 32 if: >- 33 github.repository == 'kubeflow/training-operator' && 34 (github.ref == 'refs/heads/master' || (startsWith(github.ref, 'refs/heads/v') && endsWith(github.ref, '-branch')) || startsWith(github.ref, 'refs/tags/v')) 35 uses: docker/login-action@v2 36 with: 37 username: ${{ secrets.DOCKERHUB_USERNAME }} 38 password: ${{ secrets.DOCKERHUB_TOKEN }} 39 40 - name: Publish Component ${{ inputs.component-name }} 41 # Trigger workflow only for kubeflow/training-operator repository with specific branch (master, v.*-branch) or tag (v.*). 42 if: >- 43 github.repository == 'kubeflow/training-operator' && 44 (github.ref == 'refs/heads/master' || (startsWith(github.ref, 'refs/heads/v') && endsWith(github.ref, '-branch')) || startsWith(github.ref, 'refs/tags/v')) 45 id: publish 46 uses: ./.github/workflows/template-publish-image 47 with: 48 image: docker.io/kubeflow/${{ inputs.component-name }} 49 dockerfile: ${{ inputs.dockerfile }} 50 platforms: ${{ inputs.platforms }} 51 push: true 52 53 - name: Test Build For Component ${{ inputs.component-name }} 54 if: steps.publish.outcome == 'skipped' 55 uses: ./.github/workflows/template-publish-image 56 with: 57 image: docker.io/kubeflow/${{ inputs.component-name }} 58 dockerfile: ${{ inputs.dockerfile }} 59 platforms: ${{ inputs.platforms }} 60 push: false