mirror of https://github.com/nirenjan/libx52.git
67 lines
1.8 KiB
YAML
67 lines
1.8 KiB
YAML
name: Build Docker CI Images
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
distros:
|
|
description: "List distros to build (space separated)"
|
|
type: string
|
|
default: "ALL"
|
|
push:
|
|
paths:
|
|
- "docker/Dockerfile.*"
|
|
- "docker/*.sh"
|
|
|
|
jobs:
|
|
detect-changes:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
BUILD_DOCKER_MANUAL_ENV: ${{ inputs.distros || '' }}
|
|
outputs:
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0 # Needed for detecting changes
|
|
|
|
- name: Set build matrix
|
|
id: set-matrix
|
|
run: .github/scripts/get-changed-dockerfiles.sh >> $GITHUB_OUTPUT
|
|
|
|
build-and-push:
|
|
needs: detect-changes
|
|
if: ${{ needs.detect-changes.outputs.matrix != '[]' }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false # Don't cancel other distros if this one fails
|
|
matrix:
|
|
distro: ${{ fromJson(needs.detect-changes.outputs.matrix) }}
|
|
permissions:
|
|
packages: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Login to GHCR
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: docker
|
|
file: ./docker/Dockerfile.${{ matrix.distro }}
|
|
push: true
|
|
tags: ghcr.io/${{ github.repository }}/ci-build-${{ matrix.distro }}:latest
|
|
|
|
- name: Cleanup old builds
|
|
uses: actions/delete-package-versions@v5
|
|
with:
|
|
package-name: libx52/ci-build-${{ matrix.distro }}
|
|
package-type: container
|
|
delete-only-untagged-versions: true
|