Skip to content

Tmp: output container image manifest #36

Tmp: output container image manifest

Tmp: output container image manifest #36

name: container-images
on:
push:
branches:
- main
tags:
- '**'
pull_request:
branches:
- main
jobs:
build-and-push-images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
image:
- function-mmsys-test-encode
- function-mmsys-test-scene-detection
- function-noop
- function-sleep
- gateway-nbmp
- workflow-manager
- workflow-manager-helper
- workflow-opentelemetry-adapter
- workflow-vacuum
env:
IMAGE_PLATFORMS: linux/amd64,linux/arm,linux/arm64,linux/ppc64le,linux/s390x
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
if: ${{ github.event_name == 'push' }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: set up Docker buildx
uses: docker/setup-buildx-action@v3
with:
platforms: ${{ env.IMAGE_PLATFORMS }}
- name: info
id: info
run: |
VERSION=dev
if [ "${{ github.ref_type }}" = 'tag' ]; then
VERSION="${{ github.ref_name }}"
fi
echo "VERSION=${VERSION}" | tee -a "$GITHUB_OUTPUT"
- name: build and push container images
run: |
case "${{ github.event_name }}" in
push) BUILDX_OUTPUT='--push' ;;
*) BUILDX_OUTPUT='' ;;
esac
make image-${{ matrix.image }} \
VERSION=${{ steps.info.outputs.VERSION }} \
IMAGE_PLATFORMS=${{ env.IMAGE_PLATFORMS }} \
BUILDX_OUTPUT="${BUILDX_OUTPUT}"
- name: fetch container image shas
id: container-image
run: |
docker manifest inspect ghcr.io/nagare-media/engine/${{ matrix.image }}:${{ steps.info.outputs.VERSION }}
shas=$(docker manifest inspect ghcr.io/nagare-media/engine/${{ matrix.image }}:${{ steps.info.outputs.VERSION }} | jq -r '.manifests.[] | .digest' | paste -s -d ' ' -)
echo "SHAS=$shas" | tee -a "$GITHUB_OUTPUT"
- name: delete untagged container images
uses: snok/[email protected]
if: ${{ github.event_name == 'push' }}
with:
account: nagare-media
token: ${{ secrets.GITHUB_TOKEN }}
tag-selection: untagged
image-names: engine/${{ matrix.image }}
image-tags: ${{ steps.info.outputs.VERSION }}
skip-shas: ${{ steps.container-image.outputs.SHAS }}
cut-off: 1d