Skip to content

Commit e1928e2

Browse files
committed
ci: build and push container images after merge
The container images should get pushed to quay.io after a PR has been merged. This currently builds the container images for all the architectures that the golang base container and Docker Actions support. Signed-off-by: Niels de Vos <ndevos@redhat.com>
1 parent a2df0e2 commit e1928e2

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/build-push.yaml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
name: Publish container images in quay.io
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
push_controller:
11+
name: Push controller container image to quay.io
12+
if: github.repository == 'csi-addons/kubernetes-csi-addons'
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check out the repo
16+
uses: actions/checkout@v2
17+
18+
- name: Set up QEMU
19+
uses: docker/setup-qemu-action@v1
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v1
23+
24+
- name: Login to quay.io
25+
uses: docker/login-action@v1
26+
with:
27+
registry: quay.io
28+
username: ${{ secrets.QUAY_USERNAME }}
29+
password: ${{ secrets.QUAY_PASSWORD }}
30+
31+
- name: Build and push controller container image
32+
uses: docker/build-push-action@v2
33+
with:
34+
context: .
35+
file: Dockerfile
36+
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/arm/v7
37+
push: true
38+
tags: quay.io/csi-addons/k8s-controller:latest
39+
40+
push_sidecar:
41+
name: Push sidecar container image to quay.io
42+
if: github.repository == 'csi-addons/kubernetes-csi-addons'
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Check out the repo
46+
uses: actions/checkout@v2
47+
48+
- name: Set up QEMU
49+
uses: docker/setup-qemu-action@v1
50+
51+
- name: Set up Docker Buildx
52+
uses: docker/setup-buildx-action@v1
53+
54+
- name: Login to quay.io
55+
uses: docker/login-action@v1
56+
with:
57+
registry: quay.io
58+
username: ${{ secrets.QUAY_USERNAME }}
59+
password: ${{ secrets.QUAY_PASSWORD }}
60+
61+
- name: Build and push sidecar container image
62+
uses: docker/build-push-action@v2
63+
with:
64+
context: .
65+
file: build/Containerfile.sidecar
66+
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/arm/v7
67+
push: true
68+
tags: quay.io/csi-addons/k8s-sidecar:latest

0 commit comments

Comments
 (0)