From f1d2eccc314ddc1dbbff1f4ccdf04d910c629c75 Mon Sep 17 00:00:00 2001 From: "Sun, Xuehao" Date: Fri, 16 Aug 2024 17:11:19 +0800 Subject: [PATCH] split jobs Signed-off-by: Sun, Xuehao --- .github/workflows/manual-freeze-images.yml | 4 +- .github/workflows/manual-freeze-tag.yml | 44 ++++++++++++++++++++++ .github/workflows/scripts/freeze_images.sh | 4 -- 3 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/manual-freeze-tag.yml diff --git a/.github/workflows/manual-freeze-images.yml b/.github/workflows/manual-freeze-images.yml index c7ce2ca7b1..3d792b1804 100644 --- a/.github/workflows/manual-freeze-images.yml +++ b/.github/workflows/manual-freeze-images.yml @@ -1,13 +1,13 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -name: Freeze-requirements +name: Freeze-images on: workflow_dispatch: jobs: - freeze-requirements: + freeze-images: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/manual-freeze-tag.yml b/.github/workflows/manual-freeze-tag.yml new file mode 100644 index 0000000000..cf9507de8b --- /dev/null +++ b/.github/workflows/manual-freeze-tag.yml @@ -0,0 +1,44 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +name: Freeze-tag + +on: + workflow_dispatch: + inputs: + tag: + default: "latest" + description: "Tag to apply to images" + required: true + type: string + +jobs: + freeze-tag: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.ref }} + + - uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Set up Git + run: | + git config --global user.name "NeuralChatBot" + git config --global user.email "grp_neural_chat_bot@intel.com" + git remote set-url origin https://NeuralChatBot:"${{ secrets.ACTION_TOKEN }}"@github.com/opea-project/GenAIExamples.git + + - name: Run script + run: | + find . -name "*.md" | xargs sed -i "s|^docker\ compose|TAG=${{ github.event.inputs.tag }}\ docker\ compose|g" + + - name: Commit changes + run: | + git add . + git commit -s -m "Freeze images tag" + git push diff --git a/.github/workflows/scripts/freeze_images.sh b/.github/workflows/scripts/freeze_images.sh index 4cb9a58214..fcc1425888 100644 --- a/.github/workflows/scripts/freeze_images.sh +++ b/.github/workflows/scripts/freeze_images.sh @@ -18,10 +18,6 @@ function replace_image_version() { find . -name "Dockerfile" | xargs sed -i "s|$repo_image:latest|$repo_image:$version|g" } -function freeze_tag_in_markdown() { - find . -name "*.md" | xargs sed -i "s|^docker\ compose|TAG=$GITHUB_REF_NAME\ docker\ compose|g" -} - function check_branch_name() { if [[ "$GITHUB_REF_NAME" == "main" ]]; then echo "$GITHUB_REF_NAME is protected branch"