File tree 3 files changed +123
-0
lines changed
3 files changed +123
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Copyright (C) 2024 Intel Corporation
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ name : Freeze-images
5
+
6
+ on :
7
+ workflow_dispatch :
8
+
9
+ jobs :
10
+ freeze-images :
11
+ runs-on : ubuntu-latest
12
+
13
+ steps :
14
+ - name : Checkout repository
15
+ uses : actions/checkout@v4
16
+ with :
17
+ fetch-depth : 0
18
+ ref : ${{ github.ref }}
19
+
20
+ - uses : actions/setup-python@v5
21
+ with :
22
+ python-version : " 3.10"
23
+
24
+ - name : Set up Git
25
+ run : |
26
+ git config --global user.name "NeuralChatBot"
27
+ git config --global user.email "grp_neural_chat_bot@intel.com"
28
+ git remote set-url origin https://NeuralChatBot:"${{ secrets.ACTION_TOKEN }}"@github.com/opea-project/GenAIExamples.git
29
+
30
+ - name : Run script
31
+ run : |
32
+ bash .github/workflows/scripts/freeze_images.sh
33
+
34
+ - name : Commit changes
35
+ run : |
36
+ git add .
37
+ git commit -s -m "Freeze images tag"
38
+ git push
Original file line number Diff line number Diff line change
1
+ # Copyright (C) 2024 Intel Corporation
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ name : Freeze-tag
5
+
6
+ on :
7
+ workflow_dispatch :
8
+ inputs :
9
+ tag :
10
+ default : " latest"
11
+ description : " Tag to apply to images"
12
+ required : true
13
+ type : string
14
+
15
+ jobs :
16
+ freeze-tag :
17
+ runs-on : ubuntu-latest
18
+
19
+ steps :
20
+ - name : Checkout repository
21
+ uses : actions/checkout@v4
22
+ with :
23
+ fetch-depth : 0
24
+ ref : ${{ github.ref }}
25
+
26
+ - uses : actions/setup-python@v5
27
+ with :
28
+ python-version : " 3.10"
29
+
30
+ - name : Set up Git
31
+ run : |
32
+ git config --global user.name "NeuralChatBot"
33
+ git config --global user.email "grp_neural_chat_bot@intel.com"
34
+ git remote set-url origin https://NeuralChatBot:"${{ secrets.ACTION_TOKEN }}"@github.com/opea-project/GenAIExamples.git
35
+
36
+ - name : Run script
37
+ run : |
38
+ find . -name "*.md" | xargs sed -i "s|^docker\ compose|TAG=${{ github.event.inputs.tag }}\ docker\ compose|g"
39
+
40
+ - name : Commit changes
41
+ run : |
42
+ git add .
43
+ git commit -s -m "Freeze images tag"
44
+ git push
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Copyright (C) 2024 Intel Corporation
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ function get_latest_version() {
7
+ repo_image=$1
8
+ versions=$( curl -s " https://registry.hub.docker.com/v2/repositories/$repo_image /tags/" | jq ' ."results"[]["name"]' | tr -d ' "' )
9
+ echo " version list: $versions "
10
+ latest_version=$( printf " %s\n" " ${versions[@]} " | grep -v " latest" | sort -V | tail -n 1)
11
+ echo " latest version: $latest_version "
12
+ replace_image_version $repo_image $latest_version
13
+ }
14
+
15
+ function replace_image_version() {
16
+ repo_image=$1
17
+ version=$2
18
+ find . -name " Dockerfile" | xargs sed -i " s|$repo_image :latest|$repo_image :$version |g"
19
+ }
20
+
21
+ function check_branch_name() {
22
+ if [[ " $GITHUB_REF_NAME " == " main" ]]; then
23
+ echo " $GITHUB_REF_NAME is protected branch"
24
+ exit 0
25
+ else
26
+ echo " branch name is $GITHUB_REF_NAME "
27
+ fi
28
+ }
29
+
30
+ function main() {
31
+ check_branch_name
32
+ repo_image_list=" langchain/langchain"
33
+ for repo_image in $repo_image_list ; do
34
+ echo " ::group::check $repo_image "
35
+ get_latest_version $repo_image
36
+ echo " ::endgroup::"
37
+ done
38
+ freeze_tag_in_markdown
39
+ }
40
+
41
+ main
You can’t perform that action at this time.
0 commit comments