forked from opea-project/GenAIExamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhance image publish action (opea-project#659)
Signed-off-by: chensuyue <[email protected]>
- Loading branch information
Showing
1 changed file
with
23 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,36 +5,36 @@ name: Examples publish docker image on manual event | |
on: | ||
workflow_dispatch: | ||
inputs: | ||
nodes: | ||
node: | ||
default: "gaudi" | ||
description: "Hardware to run test" | ||
required: true | ||
type: string | ||
examples: | ||
default: "ChatQnA" | ||
default: "Translation" | ||
description: 'List of examples to test [AudioQnA,ChatQnA,CodeGen,CodeTrans,DocSum,FaqGen,SearchQnA,Translation]' | ||
required: true | ||
type: string | ||
tag: | ||
default: "latest" | ||
description: "Tag to apply to images" | ||
required: true | ||
type: string | ||
publish: | ||
gmc: | ||
default: false | ||
description: 'Publish images to docker hub' | ||
description: 'Publish gmc images' | ||
required: false | ||
type: boolean | ||
tag: | ||
default: "v0.9" | ||
description: "Tag to publish" | ||
required: true | ||
type: string | ||
publish_tags: | ||
default: "latest,v1.0" | ||
default: "latest,v0.9" | ||
description: 'Tag list apply to publish images' | ||
required: false | ||
type: string | ||
|
||
permissions: read-all | ||
jobs: | ||
get-image-list: | ||
runs-on: ${{ inputs.node }} | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.scan-matrix.outputs.matrix }} | ||
steps: | ||
|
@@ -44,13 +44,20 @@ jobs: | |
- name: Set Matrix | ||
id: scan-matrix | ||
run: | | ||
pip install yq | ||
examples=($(echo ${{ inputs.examples }} | tr ',' ' ')) | ||
image_list=[] | ||
for example in ${examples[@]} | ||
do | ||
echo ${example} | ||
images=$(cat ${{ github.workspace }}/${example}/docker/docker_build_compose.yaml | yq -r '.[]' | jq 'keys' | jq -c '.') | ||
image_list=$(echo ${image_list} | jq -s '.[0] + .[1] | unique' - <(echo ${images})) | ||
done | ||
if [ "${{ inputs.gmc }}" == "true" ]; then | ||
image_list=$(echo ${image_list} | jq -c '. + ["gmcmanager","gmcrouter"]') | ||
fi | ||
echo $image_list | ||
echo "matrix=$(echo ${image_list} | jq -c '.')" >> $GITHUB_OUTPUT | ||
publish: | ||
|
@@ -60,6 +67,11 @@ jobs: | |
image: ${{ fromJSON(needs.get-image-list.outputs.matrix) }} | ||
runs-on: "docker-build-${{ inputs.node }}" | ||
steps: | ||
- uses: docker/[email protected] | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USER }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Image Publish | ||
uses: opea-project/validation/actions/image-publish@main | ||
with: | ||
|