-
Notifications
You must be signed in to change notification settings - Fork 24
70 lines (62 loc) · 1.89 KB
/
Copy pathmultiarch-build.yaml
File metadata and controls
70 lines (62 loc) · 1.89 KB
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
name: Multiarch KO builds
on:
workflow_call:
inputs:
# Deprecated, left for backward compatibility but it is unused
goversion:
description: A version of Go
default: 1.21.x
required: false
type: string
koversion:
description: A KO version
default: v0.12.0
required: false
type: string
platforms:
default: all
description: A list of platforms to build the images for
required: false
type: string
registry:
default: quay.io
description: A registry to push image to
required: false
type: string
defaults:
run:
shell: bash
jobs:
multiarch-build:
name: Build images
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v6
- name: Setup Golang
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Setup ko
uses: imjasonh/setup-ko@v0.9
with:
version: ${{ inputs.koversion }}
- name: Setup make
run: |
sudo apt-get update
sudo apt-get install -y make
- name: Login to quay.io
env:
quay_user: ${{ secrets.QUAY_USER }}
quay_password: ${{ secrets.QUAY_PASSWORD }}
run: |
ko login -u="${quay_user}" -p="${quay_password}" quay.io
- name: Build and push multiarch test images
env:
ref: ${{ github.ref_name }}
run: |
echo "Building images from ${GITHUB_REF}@${GITHUB_SHA}"
# Ref: https://regex101.com/r/gcxd4h/1
major_minor="$(echo "$ref" | sed -E 's/^.*?v?([[:digit:]]+)\.([[:digit:]]+).*/\1.\2/')"
make test-images DOCKER_REPO_OVERRIDE=${{ inputs.registry }}/${{ github.repository }}/ \
KO_FLAGS="--platform=${{ inputs.platforms }} --sbom=none" TEST_IMAGE_TAG=v${major_minor}