#446 Add support to tidal image caching (#447) #1052
Workflow file for this run
This file contains 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: Publish multi-arch Docker Images | |
on: | |
push: | |
tags: | |
- "release/*" | |
- "main/*" | |
- "devel/*" | |
- "feature/*" | |
- "daily/*" | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
base: [ "noble" ] | |
build_mode: ["full", "renderer"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Prepare for Docker Build | |
id: prepare | |
run: | | |
ref_type=${{ github.ref_type }} | |
echo "REF_TYPE: ["$ref_type"]" | |
ref_name=${{ github.ref_name }} | |
echo "REF_NAME: ["$ref_name"]" | |
ref=${{ github.ref }} | |
echo "REF: ["$ref"]" | |
declare -A base_images | |
base_images[noble]=ubuntu:noble | |
base_images[mantic]=ubuntu:mantic | |
base_images[lunar]=ubuntu:lunar | |
base_images[kinetic]=ubuntu:kinetic | |
base_images[jammy]=ubuntu:jammy | |
base_images[bookworm]=debian:bookworm-slim | |
image_name="${{secrets.DOCKER_USERNAME}}/upmpdcli" | |
echo "image_name=["$image_name"]" | |
build_key="${{ matrix.base }}-${{ matrix.build_mode }}"; | |
echo "Building build_key: ["$build_key"]"; | |
declare -A special_tags | |
special_tags[noble-full]="${image_name}:latest,${image_name}:latest-full,${image_name}:stable,${image_name}:ubuntu-lts-full,${image_name}:stable-full" | |
special_tags[noble-renderer]="${image_name}:renderer,${image_name}:latest-renderer,${image_name}:stable-renderer,${image_name}:ubuntu-lts-renderer" | |
special_tags[mantic-full]="${image_name}:ubuntu-current-full" | |
special_tags[mantic-renderer]="${image_name}:ubuntu-current-renderer" | |
special_tags[bookworm-full]="${image_name}:debian-stable-full" | |
special_tags[bookworm-renderer]="${image_name}:debian-stable-renderer" | |
special_tags[bullseye-full]="${image_name}:debian-oldstable-full" | |
special_tags[bullseye-renderer]="${image_name}:debian-oldstable-renderer" | |
base=${{ matrix.base }} | |
build_mode=${{ matrix.build_mode }} | |
select_base_image=${base_images[$base]} | |
echo "select_base_image=["$select_base_image"]" | |
tags="" | |
if [ "${ref_type}" = "branch" ]; then | |
echo "branch mode"; | |
if [ "${ref_name}" = "main" ]; then | |
echo "main branch"; | |
tags="${image_name}:main-${build_key}"; | |
elif [ "${ref_name}" = "devel" ]; then | |
echo "devel branch"; | |
devel_timestamp=$(TZ=Europe/Rome date '+%Y-%m-%d-%H-%M-%S') | |
tags="${image_name}:devel-${build_key},${image_name}:devel-${build_key}-${devel_timestamp}"; | |
else | |
echo "other branch ["${ref_name}"]"; | |
tags="${image_name}:${ref_name}-${build_key}"; | |
fi | |
elif [ "${ref_type}" = "tag" ]; then | |
echo "tag mode"; | |
echo "tag is ["${ref_name}"]"; | |
tag_type=$(echo ${ref_name} | cut -d '/' -f 1) | |
tag_name=$(echo ${ref_name} | cut -d '/' -f 2) | |
release=${tag_name} | |
if [ "${tag_type}" = "release" ]; then | |
echo "release tag"; | |
tags="${image_name}:${build_key}"; | |
tags="$tags,${image_name}:${build_key}-${release}"; | |
select_special_tags=${special_tags["${build_key}"]}; | |
if [[ -n "${select_special_tags}" ]]; then | |
echo "Found special tags for ["${build_key}"]=["${select_special_tags}"]"; | |
tags="$tags,${select_special_tags}"; | |
else | |
echo "Not found special tags for ["${build_key}"]"; | |
fi | |
elif [ "${tag_type}" = "main" ]; then | |
echo "main tag"; | |
tags="${image_name}:main-${tag_name}-${build_key}"; | |
elif [ "${tag_type}" = "devel" ]; then | |
echo "devel tag"; | |
tags="${image_name}:devel-${tag_name}-${build_key}"; | |
elif [ "${tag_type}" = "feature" ]; then | |
echo "feature tag"; | |
tags="${image_name}:feature-${tag_name}-${build_key}"; | |
elif [ "${tag_type}" = "daily" ]; then | |
echo "daily build"; | |
tags="${tags},${image_name}:daily-${build_key}"; | |
fi | |
fi | |
echo "Building tags: ["${tags}"]" | |
echo "RELEASE_TAGS=${tags}" >> $GITHUB_OUTPUT | |
echo "BASE_IMAGE=${select_base_image}" >> $GITHUB_OUTPUT | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
build-args: | | |
USE_APT_PROXY=N | |
BASE_IMAGE=${{ steps.prepare.outputs.BASE_IMAGE }} | |
BUILD_MODE=${{ matrix.build_mode }} | |
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 | |
push: true | |
tags: ${{ steps.prepare.outputs.RELEASE_TAGS }} |