generated from openshift/console-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 4
71 lines (59 loc) · 2.11 KB
/
build.yaml
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
name: Build and Push Multi-Arch Image
on:
push:
branches:
- main
release:
types:
- published
workflow_dispatch:
env:
REGISTRY_USER: ${{ secrets.QUAY_USER }}
REGISTRY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
IMAGE_NAME: quay.io/kuadrant/console-plugin
jobs:
build:
name: Build and Push Multi-Arch Image
runs-on: ubuntu-22.04
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Remove Buildx Builder
run: docker buildx rm builder || true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Quay.io
uses: docker/login-action@v2
with:
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
registry: quay.io
- name: Check out code
uses: actions/checkout@v4
- name: Build and Push Multi-Arch Image (Main)
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.IMAGE_NAME }}:latest
${{ env.IMAGE_NAME }}:${{ github.sha }}
- name: Build and Push Versioned Multi-Arch Image (Release)
if: github.event_name == 'release' && github.event.action == 'published'
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ github.event.release.name }}
- name: Print main branch image URL
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: echo "Main branch image pushed to ${{ env.IMAGE_NAME }}:latest and ${{ env.IMAGE_NAME }}:${{ github.sha }}"
- name: Print versioned image URL
if: github.event_name == 'release' && github.event.action == 'published'
run: echo "Versioned image pushed to ${{ env.IMAGE_NAME }}:${{ github.event.release.name }}"