Skip to content

Commit 9c00492

Browse files
committed
Add workflow for operator latest builds
1 parent 8428754 commit 9c00492

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Multiarch Build and Push Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
build-push:
14+
name: Build and Push Multi-Arch Image
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Set up QEMU
27+
uses: docker/setup-qemu-action@v3
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Log in to GitHub Container Registry
33+
uses: docker/login-action@v3
34+
with:
35+
registry: ${{ env.REGISTRY }}
36+
username: ${{ github.repository_owner }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Extract metadata
40+
id: meta
41+
run: |
42+
GIT_SHA=$(git rev-parse --short HEAD)
43+
BUILD_TIMESTAMP=$(date +"%Y%m%d%H%M%S")
44+
VERSION_TAG="${GIT_SHA}-${BUILD_TIMESTAMP}"
45+
46+
echo "git_sha=${GIT_SHA}" >> $GITHUB_OUTPUT
47+
echo "build_timestamp=${BUILD_TIMESTAMP}" >> $GITHUB_OUTPUT
48+
echo "version_tag=${VERSION_TAG}" >> $GITHUB_OUTPUT
49+
50+
- name: Build and push image
51+
uses: docker/build-push-action@v6
52+
with:
53+
context: .
54+
target: prod
55+
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
56+
push: true
57+
tags: |
58+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
59+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version_tag }}

0 commit comments

Comments
 (0)