|
4 | 4 | branches:
|
5 | 5 | - devel
|
6 | 6 | - RELEASE_*
|
| 7 | + paths-ignore: |
| 8 | + - 'extensions/**' |
7 | 9 | workflow_dispatch:
|
8 |
| - inputs: |
9 |
| - only_extensions: |
10 |
| - description: 'Run only the extensions part of the workflow' |
11 |
| - required: false |
12 |
| - default: 'false' |
13 |
| - type: choice |
14 |
| - options: |
15 |
| - - 'true' |
16 |
| - - 'false' |
17 | 10 | schedule:
|
18 | 11 | - cron: '0 18 * * 5'
|
19 | 12 |
|
20 | 13 | jobs:
|
21 | 14 | build-amd64:
|
22 | 15 | runs-on: ubuntu-latest
|
23 |
| - if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.only_extensions != 'true' }} |
24 | 16 | strategy:
|
25 | 17 | fail-fast: false
|
26 | 18 | matrix:
|
|
100 | 92 |
|
101 | 93 | build-arm64:
|
102 | 94 | runs-on: ubuntu-latest-arm64
|
103 |
| - if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.only_extensions != 'true' }} |
104 | 95 | strategy:
|
105 | 96 | fail-fast: false
|
106 | 97 | matrix:
|
@@ -176,7 +167,7 @@ jobs:
|
176 | 167 | merge:
|
177 | 168 | needs: [build-amd64, build-arm64]
|
178 | 169 | runs-on: ubuntu-latest
|
179 |
| - if: ${{ always() && (github.event_name != 'workflow_dispatch' || github.event.inputs.only_extensions != 'true') }} |
| 170 | + if: always() |
180 | 171 | strategy:
|
181 | 172 | fail-fast: false
|
182 | 173 | matrix:
|
@@ -290,99 +281,3 @@ jobs:
|
290 | 281 | - name: Inspect images
|
291 | 282 | run: |
|
292 | 283 | cat /tmp/tags | xargs -i bash -c 'docker buildx imagetools inspect {}'
|
293 |
| -
|
294 |
| - extensions: |
295 |
| - needs: [merge] |
296 |
| - if: ${{ always() && (github.event_name != 'workflow_dispatch' || needs.merge.result != 'skipped') }} |
297 |
| - runs-on: ubuntu-latest |
298 |
| - steps: |
299 |
| - - uses: actions/checkout@v4 |
300 |
| - |
301 |
| - - name: Free root space |
302 |
| - uses: almahmoud/free-root-space@main |
303 |
| - with: |
304 |
| - verbose: true |
305 |
| - |
306 |
| - - name: Set up QEMU |
307 |
| - uses: docker/setup-qemu-action@v3 |
308 |
| - |
309 |
| - - name: Set up Docker Buildx |
310 |
| - uses: docker/setup-buildx-action@v3 |
311 |
| - |
312 |
| - - name: Login to GHCR |
313 |
| - uses: docker/login-action@v3 |
314 |
| - with: |
315 |
| - registry: ghcr.io |
316 |
| - username: ${{ github.actor }} |
317 |
| - password: ${{ secrets.GITHUB_TOKEN }} |
318 |
| - |
319 |
| - - name: Login to Dockerhub |
320 |
| - uses: docker/login-action@v3 |
321 |
| - with: |
322 |
| - username: ${{ secrets.DOCKER_USERNAME }} |
323 |
| - password: ${{ secrets.DOCKER_PASSWORD }} |
324 |
| - |
325 |
| - - name: Install dependencies |
326 |
| - run: | |
327 |
| - # Install yq for YAML parsing |
328 |
| - wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 |
329 |
| - chmod +x /usr/local/bin/yq |
330 |
| -
|
331 |
| - - name: Find extensions |
332 |
| - id: find_extensions |
333 |
| - run: | |
334 |
| - echo "extensions=$(find extensions -name 'bioc-extension.yaml' | sort)" >> $GITHUB_OUTPUT |
335 |
| -
|
336 |
| - - name: Process extensions |
337 |
| - run: | |
338 |
| - mkdir -p /tmp/extension_builds |
339 |
| - branch="${GITHUB_REF##*/}" |
340 |
| - |
341 |
| - for ext_file in $(echo "${{ steps.find_extensions.outputs.extensions }}"); do |
342 |
| - ext_dir=$(dirname "$ext_file") |
343 |
| - ext_name=$(basename "$ext_dir") |
344 |
| - |
345 |
| - echo "Processing extension: $ext_name from $ext_file" |
346 |
| - |
347 |
| - # Parse YAML directly using yq |
348 |
| - outname=$(yq '.container.outname' "$ext_file") |
349 |
| - base_image=$(yq '.container.base.image' "$ext_file") |
350 |
| - |
351 |
| - # Handle tags which could be a string, list, or map |
352 |
| - tags=$(yq -o=json '.container.base.tag' "$ext_file") |
353 |
| - |
354 |
| - # Process tags based on their type |
355 |
| - if [[ "$tags" == "null" ]]; then |
356 |
| - tags="$branch" |
357 |
| - elif [[ "$tags" == "{\"*\"}" ]]; then |
358 |
| - # Handle object format like {"3.21", "devel"} |
359 |
| - tags=$(echo "$tags" | jq -r 'keys | join(" ")') |
360 |
| - elif [[ "$tags" == "[*]" ]]; then |
361 |
| - # Handle array format |
362 |
| - tags=$(echo "$tags" | jq -r 'join(" ")') |
363 |
| - fi |
364 |
| - |
365 |
| - echo "Building extension $ext_name: $outname from $base_image with tags: $tags" |
366 |
| - |
367 |
| - # Process each tag |
368 |
| - for tag in $tags; do |
369 |
| - echo "Building for tag: $tag" |
370 |
| - |
371 |
| - # Check for Dockerfile in extension directory |
372 |
| - if [ -f "$ext_dir/Dockerfile" ]; then |
373 |
| - echo "Using extension Dockerfile at $ext_dir/Dockerfile" |
374 |
| - |
375 |
| - docker buildx build --platform linux/amd64 \ |
376 |
| - -t "ghcr.io/${{ github.repository_owner }}/$outname:$tag" \ |
377 |
| - -t "docker.io/${{ github.repository_owner }}/$outname:$tag" \ |
378 |
| - --build-arg BASE_IMAGE=$base_image \ |
379 |
| - --build-arg TAG=$tag \ |
380 |
| - --push \ |
381 |
| - "$ext_dir" |
382 |
| - |
383 |
| - echo "Successfully built and pushed $outname:$tag" |
384 |
| - else |
385 |
| - echo "No Dockerfile found for extension $ext_name" |
386 |
| - fi |
387 |
| - done |
388 |
| - done |
0 commit comments