-
Notifications
You must be signed in to change notification settings - Fork 52
98 lines (92 loc) · 2.75 KB
/
next-build-multiarch.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
#
# Copyright (c) 2020-2024 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#
name: Che Dashboard Next Build
on:
workflow_dispatch:
inputs: {}
push:
branches:
- main
env:
IMAGE: quay.io/eclipse/che-dashboard
jobs:
build-images:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
arch: [amd64,arm64]
outputs:
amd64: ${{ steps.result.outputs.amd64 }}
arm64: ${{ steps.result.outputs.arm64 }}
steps:
-
name: "Checkout Che Dashboard source code"
uses: actions/checkout@v4
-
name: "Set up QEMU"
uses: docker/setup-qemu-action@v3
-
name: "Set up Docker Buildx ${{ matrix.arch }}"
uses: docker/setup-buildx-action@v3
-
name: "Login to quay.io"
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
-
name: "Build and push ${{ matrix.arch }}"
uses: docker/build-push-action@v5
with:
context: .
file: ./build/dockerfiles/Dockerfile
platforms: linux/${{ matrix.arch }}
push: true
provenance: false
tags: ${{ env.IMAGE }}:${{ matrix.arch }}-next
-
id: result
name: "Build result outputs version"
if: ${{ success() }}
run: echo "${{ matrix.arch }}=${{ matrix.arch }}-next" >> $GITHUB_OUTPUT
create-manifest:
if: always()
needs: build-images
runs-on: ubuntu-22.04
steps:
-
name: "Docker quay.io Login"
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
-
name: "Create and push manifest"
run: |
AMEND=""
AMD64_VERSION="${{ needs['build-images'].outputs.amd64 }}"
if [ -n "$AMD64_VERSION" ]; then
AMEND+=" --amend ${{ env.IMAGE }}:$AMD64_VERSION";
fi
ARM64_VERSION="${{ needs['build-images'].outputs.arm64 }}"
if [ -n "$ARM64_VERSION" ]; then
AMEND+=" --amend ${{ env.IMAGE }}:$ARM64_VERSION";
fi
if [ -z "$AMEND" ]; then
echo "[!] The job 'build-images' didn't provide any outputs. Can't create the manifest list."
exit 1;
fi
docker manifest create ${{ env.IMAGE }}:next $AMEND
docker manifest push ${{ env.IMAGE }}:next