Skip to content

Tag with protobuf version #4

Tag with protobuf version

Tag with protobuf version #4

name: buildah-build-asam-osi
on:
workflow_dispatch:
push:
paths:
- containers/esmini-asam-osi/**
- .github/workflows/buildah-build-asam-osi.yml # Self-trigger
env:
REGISTRY: ghcr.io/bounverif
IMAGE_NAME: esmini
PODMAN_ARCH: amd64
PLATFORM: linux-amd64
ESMINI_BUILD_OSI_VERSION: 3.5.0
ESMINI_BUILD_OSI_VERSION_LATEST: 3.7.0
ESMINI_BUILD_PROTOBUF_VERSION: 3.15.8
ESMINI_BUILD_PROTOBUF_VERSION_LATEST: 5.29.0
permissions:
contents: read
packages: write
jobs:
buildah-build:
name: Build container images
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm]
runs-on: ${{ matrix.os }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}
cancel-in-progress: true
steps:
- name: Install container tools
run: sudo apt-get install podman buildah jq
- name: Prepare environment variables
run: |
echo "PODMAN_ARCH=$(podman info --format='{{.Host.Arch}}')" >> $GITHUB_ENV
echo "PLATFORM=$(podman info --format='{{.Version.OsArch}}' | sed 's/\//-/g')" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the GitHub Container registry
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build OpenSimulationInterface container image
id: build-asam-osi
uses: redhat-actions/buildah-build@v2
with:
context: ./containers/esmini-asam-osi
image: ${{ env.IMAGE_NAME }}
tags: ;
${{ env.ESMINI_BUILD_OSI_VERSION }}-${{ env.ESMINI_BUILD_PROTOBUF_VERSION }}-asam-osi
${{ env.ESMINI_BUILD_OSI_VERSION }}-${{ env.ESMINI_BUILD_PROTOBUF_VERSION }}-asam-osi-${{ env.PODMAN_ARCH }}
layers: true
oci: true
build-args: |
ESMINI_IMAGE_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
ESMINI_BUILD_OSI_VERSION=${{ env.ESMINI_BUILD_OSI_VERSION }}
ESMINI_BUILD_PROTOBUF_VERSION=${{ env.ESMINI_BUILD_PROTOBUF_VERSION }}
extra-args: |
--target esmini-asam-osi
containerfiles: |
./containers/esmini-asam-osi/Dockerfile
- name: Push to GitHub Container Repository
if: github.ref == 'refs/heads/main'
id: push-asam-osi-ghcr
uses: redhat-actions/push-to-registry@v2
with:
registry: ${{ env.REGISTRY }}
image: ${{ steps.build-asam-osi.outputs.image }}
tags: ${{ env.ESMINI_BUILD_OSI_VERSION }}-${{ env.ESMINI_BUILD_PROTOBUF_VERSION }}-asam-osi-${{ env.PODMAN_ARCH }}
digestfile: ${{ runner.temp }}/digest-esmini-asam-osi-${{ env.PLATFORM }}
- name: Upload digests
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: digest-esmini-${{ env.ESMINI_BUILD_OSI_VERSION }}-${{ env.ESMINI_BUILD_PROTOBUF_VERSION }}-${{ env.PLATFORM }}
path: ${{ runner.temp }}/digest-*
if-no-files-found: error
retention-days: 1
compression-level: 0 # no compression
buildah-merge:
name: Merge container images
runs-on: ubuntu-24.04
needs: buildah-build
if: github.ref == 'refs/heads/main' && always()
steps:
# - run: mkdir -p $TMPDIR
- name: Download digests
uses: actions/download-artifact@v4
with:
path: ${{ runner.temp }}/digests
pattern: digest-*
merge-multiple: true
- name: Log in to the GitHub Container registry
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push manifest list for ASAM OSI
run: |
MANIFEST=esmini-asam-osi
FULL_IMAGE_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
buildah manifest create $MANIFEST
for digest in ${{ runner.temp }}/digests/digest-esmini-*; do
echo "Adding $(cat $digest)"
buildah manifest add $MANIFEST $FULL_IMAGE_NAME@$(cat $digest)
done
buildah manifest push --all $MANIFEST docker://$FULL_IMAGE_NAME:${{ env.ESMINI_BUILD_OSI_VERSION }}-${{ env.ESMINI_BUILD_PROTOBUF_VERSION }}-asam-osi
if [ "${{ env.ESMINI_BUILD_OSI_VERSION }}" == "${{ env.ESMINI_BUILD_OSI_VERSION_LATEST }}" ]; then
buildah manifest push --all $MANIFEST docker://$FULL_IMAGE_NAME:latest-${{ env.ESMINI_BUILD_PROTOBUF_VERSION }}-asam-osi
fi