Update to 3.21 and add shutdown script #19
This file contains hidden or 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: Build Bioconductor Extension Images | |
on: | |
push: | |
branches: | |
- devel | |
- RELEASE_* | |
paths: | |
- 'extensions/**' | |
workflow_dispatch: | |
inputs: | |
specific_extension: | |
description: 'Build only a specific extension (folder name in extensions/)' | |
required: false | |
type: string | |
schedule: | |
- cron: '0 20 * * 5' # Run every Friday at 8PM UTC | |
jobs: | |
build-extensions: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Free root space | |
uses: almahmoud/free-root-space@main | |
with: | |
verbose: true | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to Dockerhub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Install dependencies | |
run: | | |
# Install yq for YAML parsing | |
wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 | |
chmod +x /usr/local/bin/yq | |
- name: Process and build extensions | |
run: | | |
# Get branch name | |
branch="${GITHUB_REF##*/}" | |
# Convert repository owner to lowercase for Docker compatibility | |
REPO_OWNER="${{ github.repository_owner }}" | |
REPO_OWNER_LOWER=$(echo "$REPO_OWNER" | tr '[:upper:]' '[:lower:]') | |
# Find extensions based on input or search all | |
if [[ -n "${{ github.event.inputs.specific_extension }}" ]]; then | |
if [[ ! -d "extensions/${{ github.event.inputs.specific_extension }}" ]]; then | |
echo "::error::Extension directory not found: extensions/${{ github.event.inputs.specific_extension }}" | |
exit 1 | |
fi | |
extension_files=$(find extensions/${{ github.event.inputs.specific_extension }} -name 'bioc-extension.yaml') | |
echo "Building specific extension: ${{ github.event.inputs.specific_extension }}" | |
else | |
extension_files=$(find extensions -name 'bioc-extension.yaml' | sort) | |
echo "Building all available extensions" | |
fi | |
# Process each extension file directly | |
for ext_file in $extension_files; do | |
ext_dir=$(dirname "$ext_file") | |
ext_name=$(basename "$ext_dir") | |
echo "Processing extension: $ext_name from $ext_file" | |
# Check if Dockerfile exists | |
if [[ ! -f "$ext_dir/Dockerfile" ]]; then | |
echo "::warning::No Dockerfile found for extension $ext_name, skipping" | |
continue | |
fi | |
# Parse YAML directly using yq | |
outname=$(yq '.container.outname' "$ext_file" | tr '[:upper:]' '[:lower:]') | |
base_image=$(yq '.container.base.image' "$ext_file" | tr '[:upper:]' '[:lower:]') | |
# Handle tags | |
tags_count=$(yq '.container.base.tag | length' "$ext_file") | |
# Build for each tag (or branch name if no tags specified) | |
if [[ $tags_count -eq 0 ]]; then | |
tags=("$branch") | |
else | |
# Get all tags as an array | |
tags=() | |
for (( i=0; i<$tags_count; i++ )); do | |
tags+=("$(yq ".container.base.tag[$i]" "$ext_file")") | |
done | |
fi | |
# Build for each tag | |
for tag in "${tags[@]}"; do | |
echo "Building $outname:$tag from $base_image:$tag using Dockerfile in $ext_dir" | |
# Build and push with lowercase names | |
docker buildx build --platform linux/amd64 \ | |
-t "ghcr.io/$REPO_OWNER_LOWER/$outname:$tag" \ | |
-t "docker.io/$REPO_OWNER_LOWER/$outname:$tag" \ | |
--build-arg BASE_IMAGE=$base_image \ | |
--build-arg TAG=$tag \ | |
--push \ | |
"$ext_dir" | |
build_result=$? | |
if [ $build_result -ne 0 ]; then | |
echo "::error::Failed to build $outname:$tag" | |
exit $build_result | |
fi | |
echo "Successfully built and pushed $outname:$tag" | |
done | |
done |