Skip to content

Commit 4e88cd7

Browse files
authored
Refactor CI to build for multiple architectures
Refactor build process to use a matrix strategy for multiple architectures and consolidate steps for building container images.
1 parent f65f5a0 commit 4e88cd7

File tree

1 file changed

+19
-65
lines changed

1 file changed

+19
-65
lines changed

.github/workflows/build-extension.yml

Lines changed: 19 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,19 @@ jobs:
2929
esac
3030
echo "##" >> "$GITHUB_OUTPUT"
3131
32-
build-amd64:
33-
name: Build Container Image and Helm Chart - amd64
34-
runs-on: ubuntu-24.04
32+
build:
33+
strategy:
34+
matrix:
35+
arch:
36+
- amd64
37+
- arm64
38+
include:
39+
- arch: amd64
40+
runner: ubuntu-24.04
41+
- arch: arm64
42+
runner: ubuntu-24.04-arm
43+
runs-on: ${{ matrix.runner }}
44+
name: Build Container Image
3545
needs: prepare
3646
env:
3747
RELEASE_TAG: ${{ needs.prepare.outputs.release_tag }}
@@ -74,77 +84,21 @@ jobs:
7484
run: |
7585
yarn parse-tag-name ${{ env.RELEASE_TAG }} ${{ github.run_id }} "catalog"
7686
77-
- name: Build and push UI image
87+
- name: Build image
7888
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }}
7989
run: |
8090
yarn publish-pkgs -c -i '' -r ghcr.io -o 'leooamaral' -t "${{ env.RELEASE_TAG }}"
8191
82-
- name: Tag amd64
92+
- name: Tag and Push Image
8393
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }}
8494
run: |
8595
VERSION=${RELEASE_TAG##*-}
86-
docker tag $IMAGE_NAME:$VERSION $IMAGE_NAME:$VERSION-amd64
87-
docker push $IMAGE_NAME:$VERSION-amd64
88-
89-
build-arm64:
90-
name: Build Container Image and Helm Chart - arm64
91-
runs-on: ubuntu-24.04-arm
92-
needs: prepare
93-
env:
94-
RELEASE_TAG: ${{ needs.prepare.outputs.release_tag }}
95-
permissions:
96-
contents: read
97-
packages: write
98-
steps:
99-
- name: Checkout repository
100-
uses: actions/checkout@v5
101-
102-
- name: Configure Git
103-
run: |
104-
git config user.name 'github-actions[bot]'
105-
git config user.email 'github-actions[bot]@users.noreply.github.com'
106-
107-
- name: Login to GitHub Container Registry
108-
uses: docker/login-action@v3
109-
with:
110-
registry: ghcr.io
111-
username: ${{ github.actor }}
112-
password: ${{ secrets.GITHUB_TOKEN }}
113-
114-
- name: Setup Nodejs with yarn caching
115-
uses: actions/setup-node@v5
116-
with:
117-
node-version: '20'
118-
cache: yarn
119-
120-
- name: Enable Corepack
121-
run: corepack enable
122-
123-
- name: Install dependencies
124-
run: yarn
125-
126-
- name: Parse Extension Name
127-
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }}
128-
id: parsed-name
129-
env:
130-
GH_TOKEN: ${{ github.token }}
131-
run: |
132-
yarn parse-tag-name ${{ env.RELEASE_TAG }} ${{ github.run_id }} "catalog"
133-
134-
- name: Build and push UI image
135-
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }}
136-
run: |
137-
yarn publish-pkgs -c -i '' -r ghcr.io -o 'leooamaral' -t "${{ env.RELEASE_TAG }}"
138-
139-
- name: Tag arm64
140-
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }}
141-
run: |
142-
VERSION=${RELEASE_TAG##*-}
143-
docker tag $IMAGE_NAME:$VERSION $IMAGE_NAME:$VERSION-arm64
144-
docker push $IMAGE_NAME:$VERSION-arm64
96+
docker tag $IMAGE_NAME:$VERSION $IMAGE_NAME:$VERSION-${{ matrix.arch }}
97+
docker push $IMAGE_NAME:$VERSION-${{ matrix.arch }}
14598
14699
manifest:
147-
needs: [prepare, build-amd64, build-arm64]
100+
name: Create Container Manifest and Helm Chart
101+
needs: [prepare, build]
148102
env:
149103
RELEASE_TAG: ${{ needs.prepare.outputs.release_tag }}
150104
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)