Skip to content

ci: Add workflow_dispatch trigger for build #41

ci: Add workflow_dispatch trigger for build

ci: Add workflow_dispatch trigger for build #41

name: Build and Push
on:
workflow_dispatch:
push:
branches: [ main, 'release-[0-9].[0-9]+' ]
tags: [ 'v*.*.*' ]
paths-ignore: [ '**.md' ]
pull_request:
branches: [ main, 'release-[0-9].[0-9]+' ]
paths-ignore: [ '**.md' ]
env:
IMAGE_NAME: "kserve/modelmesh-minio-examples"
DEV_IMAGE_NAME: "kserve/modelmesh-minio-dev-examples"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
- name: Set up buildx
uses: docker/setup-buildx-action@v1
- name: Metadata examples image
id: meta-examples
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
tags: |
# temporarily tag images from pull requests
type=ref,event=pr
# last commit on default branch
type=edge,branch=$repo.default_branch
# use last commit sha as tag sha-ad132f5 (short sha)
type=sha
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
# use raw git tag value as image version tag
type=semver,pattern={{raw}}
- name: Metadata FVT image
id: meta-fvt
uses: docker/metadata-action@v4
with:
images: ${{ env.DEV_IMAGE_NAME }}
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
# use raw git tag value as image version tag
type=semver,pattern={{raw}}
labels: |
org.opencontainers.image.title=modelmesh-minio-dev-examples
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Build and push examples image
id: build-and-push-examples-image
uses: docker/build-push-action@v3
with:
platforms: linux/amd64,linux/arm64/v8,linux/ppc64le,linux/s390x
pull: true
target: minio-examples
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-examples.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push FVT image
id: build-and-push-fvt-image
uses: docker/build-push-action@v3
with:
platforms: linux/amd64,linux/arm64/v8,linux/ppc64le,linux/s390x
pull: true
target: minio-fvt
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-fvt.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max