mirror of
https://github.com/digitalsamba/claude-code-video-toolkit.git
synced 2026-09-18 19:41:13 +08:00
b86feda618
Node.js 20 is being forced to Node 24 on GHA runners starting June 2nd, 2026, then removed Sep 16th, 2026. Each major bump below was the action's explicit Node 24 transition release; none touch inputs we use. - actions/checkout@v4 → @v6 (Node 24 since v5) - docker/setup-buildx-action@v3 → @v4 - docker/login-action@v3 → @v4 - docker/metadata-action@v5 → @v6 - docker/build-push-action@v5 → @v7 - softprops/action-gh-release@v2 → @v3 - peter-evans/create-pull-request@v6 → @v8
112 lines
3.5 KiB
YAML
112 lines
3.5 KiB
YAML
name: Build Docker Images
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- 'docker/**/Dockerfile'
|
|
- 'docker/**/handler.py'
|
|
- '.github/workflows/docker-build.yml'
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
inputs:
|
|
image:
|
|
description: 'Image to build (e.g., runpod-qwen3-tts). Leave empty to build all changed images.'
|
|
required: false
|
|
type: string
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_PREFIX: ${{ github.repository_owner }}/video-toolkit
|
|
|
|
jobs:
|
|
detect-changes:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
images: ${{ steps.changes.outputs.images }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0 # full history needed to diff across multi-commit pushes
|
|
|
|
- name: Detect changed images
|
|
id: changes
|
|
run: |
|
|
if [ -n "${{ github.event.inputs.image }}" ]; then
|
|
# Manual dispatch with specific image
|
|
echo "images=[\"${{ github.event.inputs.image }}\"]" >> $GITHUB_OUTPUT
|
|
else
|
|
# Diff across the full push range, not just HEAD~1..HEAD
|
|
BASE="${{ github.event.before }}"
|
|
if [ -z "$BASE" ] || [ "$BASE" = "0000000000000000000000000000000000000000" ]; then
|
|
BASE="HEAD~1"
|
|
fi
|
|
CHANGED=$(git diff --name-only "$BASE" HEAD -- 'docker/*/Dockerfile' 'docker/*/handler.py' | \
|
|
sed 's|docker/\([^/]*\)/.*|\1|' | sort -u | jq -R . | jq -sc .)
|
|
if [ "$CHANGED" = "[]" ]; then
|
|
# Fallback: only build images that have a Dockerfile (modal-* dirs use Python API at deploy time)
|
|
CHANGED=$(for d in docker/*/; do [ -f "$d/Dockerfile" ] && basename "$d"; done | jq -R . | jq -sc .)
|
|
fi
|
|
echo "images=$CHANGED" >> $GITHUB_OUTPUT
|
|
fi
|
|
echo "Images to build: $(cat $GITHUB_OUTPUT | grep images)"
|
|
|
|
build:
|
|
needs: detect-changes
|
|
if: needs.detect-changes.outputs.images != '[]'
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
image: ${{ fromJson(needs.detect-changes.outputs.images) }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Check Dockerfile exists
|
|
run: |
|
|
if [ ! -f "docker/${{ matrix.image }}/Dockerfile" ]; then
|
|
echo "No Dockerfile found for ${{ matrix.image }}, skipping"
|
|
exit 0
|
|
fi
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v6
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-${{ matrix.image }}
|
|
tags: |
|
|
type=raw,value=latest
|
|
type=sha,prefix=
|
|
|
|
- name: Free disk space
|
|
run: |
|
|
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
|
|
sudo apt-get clean
|
|
df -h
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: docker/${{ matrix.image }}
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha,scope=${{ matrix.image }}
|
|
cache-to: type=gha,mode=max,scope=${{ matrix.image }}
|