@@ -279,3 +279,86 @@ jobs:
279279 - name : Inspect images
280280 run : |
281281 cat /tmp/tags | xargs -i bash -c 'docker buildx imagetools inspect {}'
282+
283+ extensions :
284+ needs : [merge]
285+ runs-on : ubuntu-latest
286+ if : always()
287+ steps :
288+ - uses : actions/checkout@v4
289+
290+ - name : Free root space
291+ uses : almahmoud/free-root-space@main
292+ with :
293+ verbose : true
294+
295+ - name : Set up QEMU
296+ uses : docker/setup-qemu-action@v3
297+
298+ - name : Set up Docker Buildx
299+ uses : docker/setup-buildx-action@v3
300+
301+ - name : Login to GHCR
302+ uses : docker/login-action@v3
303+ with :
304+ registry : ghcr.io
305+ username : ${{ github.actor }}
306+ password : ${{ secrets.GITHUB_TOKEN }}
307+
308+ - name : Login to Dockerhub
309+ uses : docker/login-action@v3
310+ with :
311+ username : ${{ secrets.DOCKER_USERNAME }}
312+ password : ${{ secrets.DOCKER_PASSWORD }}
313+
314+ - name : Find extensions
315+ id : find_extensions
316+ run : |
317+ echo "extensions=$(find extensions -name 'bioc-extension.yaml' | sort)" >> $GITHUB_OUTPUT
318+
319+ - name : Process extensions
320+ run : |
321+ mkdir -p /tmp/extension_builds
322+ branch="${GITHUB_REF##*/}"
323+
324+ for ext_file in $(echo "${{ steps.find_extensions.outputs.extensions }}"); do
325+ ext_dir=$(dirname "$ext_file")
326+ ext_name=$(basename "$ext_dir")
327+
328+ echo "Processing extension: $ext_name from $ext_file"
329+
330+ # Parse the YAML file to get outname and base image details
331+ outname=$(grep -A2 outname "$ext_file" | grep -v outname | grep -v ":" | tr -d ' ' | tr -d '"' | tr -d "'")
332+ base_image=$(grep -A2 image "$ext_file" | grep -v image | grep -v ":" | tr -d ' ' | tr -d '"' | tr -d "'")
333+
334+ # Handle tags - could be a single tag or a list
335+ tags=$(grep -A5 tag "$ext_file" | grep -v tag | grep -v ":" | tr -d ' ' | tr -d '"' | tr -d "'" | tr -d "{" | tr -d "}" | tr "," " ")
336+
337+ if [ -z "$tags" ]; then
338+ tags="$branch"
339+ fi
340+
341+ echo "Building extension $ext_name: $outname from $base_image with tags: $tags"
342+
343+ # Process each tag
344+ for tag in $tags; do
345+ echo "Building for tag: $tag"
346+
347+ # Check for Dockerfile in extension directory
348+ if [ -f "$ext_dir/Dockerfile" ]; then
349+ echo "Using extension Dockerfile at $ext_dir/Dockerfile"
350+
351+ docker buildx build --platform linux/amd64 \
352+ -t "ghcr.io/${{ github.repository_owner }}/$outname:$tag" \
353+ -t "docker.io/${{ github.repository_owner }}/$outname:$tag" \
354+ --build-arg BASE_IMAGE=$base_image \
355+ --build-arg TAG=$tag \
356+ --push \
357+ "$ext_dir"
358+
359+ echo "Successfully built and pushed $outname:$tag"
360+ else
361+ echo "No Dockerfile found for extension $ext_name"
362+ fi
363+ done
364+ done
0 commit comments