-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
4 changed files
with
149 additions
and
58 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
name: Publish SourceForge multi-arch Docker images | ||
|
||
on: | ||
push: | ||
tags: | ||
- "release/*" | ||
- "main/*" | ||
- "devel/*" | ||
- "feature/*" | ||
- "daily/*" | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
base: ["bullseye", "buster"] | ||
sourceforge: ["Y"] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Prepare for docker build | ||
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_image_from_matrix | ||
base_image_from_matrix[unstable]=debian:unstable-slim | ||
base_image_from_matrix[sid]=debian:sid-slim | ||
base_image_from_matrix[bookworm]=debian:bookworm-slim | ||
base_image_from_matrix[buster]=debian:buster-slim | ||
base_image_from_matrix[bullseye]=debian:bullseye-slim | ||
base_image_from_matrix[kinetic]=ubuntu:kinetic | ||
base_image_from_matrix[jammy]=ubuntu:jammy | ||
select_base_image=${base_image_from_matrix[${{ matrix.base }}]} | ||
if [ -z "${select_base_image}" ]; then | ||
select_base_image=debian:buster-slim | ||
fi | ||
echo "Select Base Image [" $select_base_image "]" | ||
image_name=${{secrets.DOCKER_USERNAME}}/squeezelite | ||
declare -A special_tags | ||
special_tags[bullseye-Y]="${image_name}:sourceforge-latest" | ||
special_tags[buster-Y]="${image_name}:sourceforge-legacy" | ||
squeezelite_version_str="" | ||
distro_id=${{ matrix.base }} | ||
squeezelite_version_str="squeezelite-1.9.9-sourceforge" | ||
tags="" | ||
if [ "${ref_type}" = "branch" ]; then | ||
echo "branch mode"; | ||
if [ "${ref_name}" = "main" ]; then | ||
echo "main branch"; | ||
tags="${image_name}:main-${distro_id}-${squeezelite_version_str}"; | ||
elif [ "${ref_name}" = "devel" ]; then | ||
echo "devel branch"; | ||
tags="${image_name}:devel-${distro_id}-${squeezelite_version_str}" | ||
else | ||
echo "other branch ["${ref_name}"]"; | ||
tags="${image_name}:branch-${ref_name}-${distro_id}-${squeezelite_version_str}"; | ||
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) | ||
if [ "${tag_type}" = "release" ]; then | ||
echo "release tag"; | ||
tags="$image_name:${distro_id}-${squeezelite_version_str}" | ||
tags="$tags,$image_name:${distro_id}-${squeezelite_version_str}-${tag_name}" | ||
building_now="${distro_id}-${{ matrix.sourceforge }}"; | ||
echo "Building now: ["$building_now"]"; | ||
select_special_tags=${special_tags["${building_now}"]}; | ||
if [[ -n "${select_special_tags}" ]]; then | ||
echo "Found special tags for ["${building_now}"]=["${select_special_tags}"]"; | ||
tags="$tags,${select_special_tags}"; | ||
else | ||
echo "Not found special tags for ["${building_now}"]"; | ||
fi | ||
tags="${tags},$image_name:sourceforge-${distro_id}"; | ||
elif [ "${tag_type}" = "main" ]; then | ||
echo "main tag"; | ||
tags="${image_name}:main-${tag_name}-${distro_id}-${squeezelite_version_str}"; | ||
elif [ "${tag_type}" = "devel" ]; then | ||
echo "devel tag"; | ||
tags="${image_name}:devel-${tag_name}-${distro_id}-${squeezelite_version_str}"; | ||
elif [ "${tag_type}" = "feature" ]; then | ||
echo "devel tag"; | ||
tags="${image_name}:feature-${tag_name}-${distro_id}-${squeezelite_version_str}"; | ||
elif [ "${tag_type}" = "daily" ]; then | ||
echo "daily build"; | ||
tags="${tags},${image_name}:daily-${distro_id}-${squeezelite_version_str}"; | ||
fi | ||
fi | ||
echo "Building tags: ["${tags}"]" | ||
echo "RELEASE_TAGS=${tags}" >> $GITHUB_ENV | ||
echo "BASE_IMAGE=${select_base_image}" >> $GITHUB_ENV | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
with: | ||
platforms: all | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
build-args: | | ||
BASE_IMAGE=${{ env.BASE_IMAGE }} | ||
DOWNLOAD_FROM_SOURCEFORGE=${{ matrix.sourceforge }} | ||
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 | ||
push: true | ||
tags: ${{ env.RELEASE_TAGS }} |
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
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