-
Notifications
You must be signed in to change notification settings - Fork 3
117 lines (106 loc) · 3.33 KB
/
release-image-check.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Check Build Image
on:
workflow_call:
inputs:
MAKE_OPS_PRE:
description: "The pre ops name of makefile (e.g. generate)"
type: string
required: false
default: ''
IMG:
description: "The URL to use building/pushing image targets (e.g. apecloud/kubeblocks)"
type: string
required: false
default: ''
BUILDX_PLATFORMS:
description: "buildx platforms (default: linux/amd64,linux/arm64)"
type: string
required: false
default: 'linux/amd64,linux/arm64'
BUILDX_ARGS:
description: "buildx args (default: --sbom=false --provenance=false)"
type: string
required: false
default: ''
GO_VERSION:
description: "Install the specify version of GO"
type: string
required: false
default: ''
CONTEXT:
description: "Build's context is the set of files located in the specified PATH or URL (default: .)"
type: string
required: false
default: '.'
DOCKERFILE_PATH:
description: "Path to the Dockerfile (default: ./Dockerfile)"
type: string
required: false
default: './Dockerfile'
PYTHON_VERSION:
description: "Install the specify version of Python"
type: string
required: false
default: ''
POETRY_VERSION:
description: "Install the specify version of Poetry"
type: string
required: false
default: ''
ENABLE_SUBMODULE:
description: "Enable checkout submodule (default: false)"
type: boolean
required: false
default: false
env:
GITHUB_USER: ${{ secrets.PERSONAL_ACCESS_USER }}
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
jobs:
build-image:
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
steps:
- name: Checkout Code
if: ${{ ! inputs.ENABLE_SUBMODULE }}
uses: actions/checkout@v4
- name: Checkout Code With Submodule
if: ${{ inputs.ENABLE_SUBMODULE }}
uses: actions/checkout@v4
with:
submodules: 'recursive'
token: ${{ env.GITHUB_TOKEN }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
with:
driver-opts: image=moby/buildkit:master
- name: Setup Go
if: inputs.GO_VERSION
uses: actions/setup-go@v3
with:
go-version: ${{ inputs.GO_VERSION }}
- name: Setup Python specify version
if: inputs.PYTHON_VERSION
uses: actions/setup-python@v4
with:
python-version: "${{ inputs.PYTHON_VERSION }}"
- name: Setup Poetry specify version
if: inputs.POETRY_VERSION
uses: Gr1N/setup-poetry@v8
with:
poetry-version: "${{ inputs.POETRY_VERSION }}"
- name: make pre
if: inputs.MAKE_OPS_PRE
run: |
make ${{ inputs.MAKE_OPS_PRE }}
- name: Build without push
uses: docker/build-push-action@v5
with:
context: ${{ inputs.CONTEXT }}
file: ${{ inputs.DOCKERFILE_PATH }}
platforms: ${{ inputs.BUILDX_PLATFORMS }}
tags: ${{ inputs.IMG }}:latest
build-args: ${{ inputs.BUILDX_ARGS }}
cache-from: type=gha
cache-to: type=gha,mode=max