build-release #23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build operator image for release | |
on: | |
repository_dispatch: | |
types: [build-release] | |
concurrency: | |
group: operator-${{ github.event.client_payload.version }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: 🔨 Build Binaries and Docker Image | |
strategy: | |
matrix: | |
include: | |
- platform: linux/amd64 | |
runs-on: ubuntu-24.04 | |
arch: amd64 | |
- platform: linux/arm64 | |
runs-on: ubuntu-24.04-arm | |
arch: arm64 | |
runs-on: ${{ matrix.runs-on }} | |
env: | |
GITHUB_RUN_ID: ${{ github.run_id }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go with cache | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: ./go.mod | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push image | |
if: success() | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: ${{ matrix.platform }} | |
provenance: false | |
push: true | |
file: ./Dockerfile | |
tags: ghcr.io/unbindapp/unbind-operator:${{ github.event.client_payload.version }}-${{ matrix.arch }} | |
create_manifest: | |
name: 📦 Create and Push Multi-Arch Manifest | |
runs-on: ubuntu-24.04 | |
needs: [build] | |
env: | |
GITHUB_RUN_ID: ${{ github.run_id }} | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create and push API manifest | |
run: | | |
docker manifest create ghcr.io/unbindapp/unbind-operator:${{ github.event.client_payload.version }} \ | |
--amend ghcr.io/unbindapp/unbind-operator:${{ github.event.client_payload.version }}-amd64 \ | |
--amend ghcr.io/unbindapp/unbind-operator:${{ github.event.client_payload.version }}-arm64 | |
docker manifest annotate --arch amd64 --os linux ghcr.io/unbindapp/unbind-operator:${{ github.event.client_payload.version }} ghcr.io/unbindapp/unbind-operator:${{ github.event.client_payload.version }}-amd64 | |
docker manifest annotate --arch arm64 --os linux ghcr.io/unbindapp/unbind-operator:${{ github.event.client_payload.version }} ghcr.io/unbindapp/unbind-operator:${{ github.event.client_payload.version }}-arm64 | |
docker manifest push ghcr.io/unbindapp/unbind-operator:${{ github.event.client_payload.version }} | |
# Notify meta repo that the operator image is ready | |
- name: Notify meta repo that the operator image is ready | |
if: success() | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.PAT_TOKEN }} | |
repository: unbindapp/unbind-releases | |
event-type: image-ready | |
client-payload: | | |
{ | |
"component": "operator", | |
"version": "${{ github.event.client_payload.version }}", | |
"release_id": "${{ github.event.client_payload.release_id }}" | |
} |