-
Notifications
You must be signed in to change notification settings - Fork 18
92 lines (81 loc) · 2.89 KB
/
build-and-push.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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