|
| 1 | +# Copyright (C) 2025 Intel Corporation |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +name: Update Docker Hub Description |
| 5 | +permissions: |
| 6 | + contents: read |
| 7 | +on: |
| 8 | + schedule: |
| 9 | + - cron: "0 0 * * 0" |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + get-images-matrix: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + outputs: |
| 16 | + examples_json: ${{ steps.extract.outputs.examples_json }} |
| 17 | + steps: |
| 18 | + - name: Checkout repository |
| 19 | + uses: actions/checkout@v3 |
| 20 | + |
| 21 | + - name: Extract images info and generate JSON matrix |
| 22 | + id: extract |
| 23 | + run: | |
| 24 | + #!/bin/bash |
| 25 | + set -e |
| 26 | + images=$(awk -F'|' '/^\| *\[opea\// { |
| 27 | + gsub(/^ +| +$/, "", $2); |
| 28 | + gsub(/^ +| +$/, "", $4); |
| 29 | + gsub(/^ +| +$/, "", $5); |
| 30 | +
|
| 31 | + # Extract the path portion of the dockerHub link from the Example Images column |
| 32 | + match($2, /\(https:\/\/hub\.docker\.com\/r\/[^)]*\)/); |
| 33 | + repository = substr($2, RSTART, RLENGTH); |
| 34 | + # Remove the prefix and the trailing right bracket |
| 35 | + sub(/^\(https:\/\/hub\.docker\.com\/r\//, "", repository); |
| 36 | + sub(/\)$/, "", repository); |
| 37 | +
|
| 38 | + # Description Direct assignment |
| 39 | + description = $4; |
| 40 | +
|
| 41 | + # Extract the content of the github link from the Readme column |
| 42 | + match($5, /\(https:\/\/github\.com\/[^)]*\)/); |
| 43 | + readme_url = substr($5, RSTART, RLENGTH); |
| 44 | + # Remove the prefix and the trailing right bracket |
| 45 | + sub(/^\(https:\/\/github\.com\//, "", readme_url); |
| 46 | + sub(/\)$/, "", readme_url); |
| 47 | + # Remove blob information, such as "blob/main/" or "blob/habana_main/" |
| 48 | + gsub(/blob\/[^/]+\//, "", readme_url); |
| 49 | + # Remove the organization name and keep only the file path, such as changing "opea-project/GenAIExamples/AudioQnA/README.md" to "GenAIExamples/AudioQnA/README.md" |
| 50 | + sub(/^[^\/]+\//, "", readme_url); |
| 51 | +
|
| 52 | + # Generate JSON object string |
| 53 | + printf "{\"repository\":\"%s\",\"short-description\":\"%s\",\"readme-filepath\":\"%s\"}\n", repository, description, readme_url; |
| 54 | + }' docker_images_list.md) |
| 55 | +
|
| 56 | + # Concatenate all JSON objects into a JSON array, using paste to separate them with commas |
| 57 | + json="[$(echo "$images" | paste -sd, -)]" |
| 58 | + echo "$json" |
| 59 | + # Set as output variable for subsequent jobs to use |
| 60 | + echo "::set-output name=examples_json::$json" |
| 61 | +
|
| 62 | + check-images-matrix: |
| 63 | + runs-on: ubuntu-latest |
| 64 | + needs: get-images-matrix |
| 65 | + if: ${{ needs.get-images-matrix.outputs.examples_json != '' }} |
| 66 | + strategy: |
| 67 | + matrix: |
| 68 | + image: ${{ fromJSON(needs.get-images-matrix.outputs.examples_json) }} |
| 69 | + fail-fast: false |
| 70 | + steps: |
| 71 | + - name: Check dockerhub description |
| 72 | + run: | |
| 73 | + echo "dockerhub description for ${{ matrix.image.repository }}" |
| 74 | + echo "short-description: ${{ matrix.image.short-description }}" |
| 75 | + echo "readme-filepath: ${{ matrix.image.readme-filepath }}" |
| 76 | +
|
| 77 | + dockerHubDescription: |
| 78 | + runs-on: ubuntu-latest |
| 79 | + needs: get-images-matrix |
| 80 | + if: ${{ needs.get-images-matrix.outputs.examples_json != '' }} |
| 81 | + strategy: |
| 82 | + matrix: |
| 83 | + image: ${{ fromJSON(needs.get-images-matrix.outputs.examples_json) }} |
| 84 | + fail-fast: false |
| 85 | + steps: |
| 86 | + - name: Checkout GenAIExamples |
| 87 | + uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 |
| 88 | + with: |
| 89 | + repository: opea-project/GenAIExamples |
| 90 | + path: GenAIExamples |
| 91 | + |
| 92 | + - name: Checkout GenAIComps |
| 93 | + uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 |
| 94 | + with: |
| 95 | + repository: opea-project/GenAIComps |
| 96 | + path: GenAIComps |
| 97 | + |
| 98 | + - name: Checkout vllm-openvino |
| 99 | + uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 |
| 100 | + with: |
| 101 | + repository: vllm-project/vllm |
| 102 | + path: vllm |
| 103 | + |
| 104 | + - name: Checkout vllm-gaudi |
| 105 | + uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 |
| 106 | + with: |
| 107 | + repository: HabanaAI/vllm-fork |
| 108 | + ref: habana_main |
| 109 | + path: vllm-fork |
| 110 | + |
| 111 | + - name: add dockerhub description |
| 112 | + uses: peter-evans/dockerhub-description@v4 |
| 113 | + with: |
| 114 | + username: ${{ secrets.DOCKERHUB_USER }} |
| 115 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 116 | + repository: ${{ matrix.image.repository }} |
| 117 | + short-description: ${{ matrix.image.short-description }} |
| 118 | + readme-filepath: ${{ matrix.image.readme-filepath }} |
| 119 | + enable-url-completion: false |
0 commit comments