Skip to content

First commit

First commit #1

name: AI Containers Release - Build and Publish
on:
push:
tags:
- "ai/*"
env:
GHCR_REGISTRY: ghcr.io
GHCR_DESTINATION_ORG: ghcr.io/arduino
GH_DESTINATION_REPO: https://github.com/arduino/app-bricks-py
permissions:
contents: write
packages: write
id-token: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- dockerfile: ./containers/ei-models-runner/Dockerfile
context: ./containers/ei-models-runner
image: /app-bricks/ei-models-runner
max-parallel: 1
steps:
- name: Log into destination image registry ${{ env.GHCR_REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@v4
# Add support for more platforms with QEMU
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm64
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
# Extract metadata from the GitHub context
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
tags: |
type=match,pattern=ai\/(.*),group=1
images: |
${{ env.GHCR_DESTINATION_ORG }}${{ matrix.image }}
labels: |
org.opencontainers.image.source=${{ env.GH_DESTINATION_REPO}}
org.opencontainers.image.url=${{ env.GH_DESTINATION_REPO}}
# Build and push Docker image with Buildx (don't push on PR)
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v6
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
# Images are ready. Now modify files and create a PR.
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Update AI container images references
env:
PUBLIC_IMAGE_REGISTRY_BASE: ${{ env.GHCR_DESTINATION_ORG }}/
run: |
echo "##### Installing libasound2-dev..."
sudo apt install libasound2-dev
echo "##### Installing build dependencies..."
pip install --upgrade pip build
echo "##### Installing module as installable module..."
pip install -e ".[dev]"
echo "##### Update references..."
arduino-bricks-update-ai-container-ref -v ${{ steps.meta.outputs.version }} -r ${{ env.GHCR_DESTINATION_ORG }}/
- name: Configure Git
run: |
git config user.name "AppLab Actions Bot"
git config user.email "[email protected]"
- name: Create new branch name
run: |
BRANCH_NAME="ai-container-release-$(date +"%Y%m%d%H%M%S")"
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
id: push_changes
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "feat: update AI container images references"
title: "[RELEASE BOT] Update AI container images references"
body: |
This PR was automatically generated by a GitHub Actions workflow.
It includes modifications to update AI container images references after new release.
branch: ${{ steps.push_changes.outputs.branch_name }}
base: main # Target branch for the PR
draft: false