From 2258d6ffb15c92b6c17913f178aa149dba2a0cee Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Fri, 2 Sep 2022 10:15:01 +0800 Subject: [PATCH 1/4] [Breaking Change + Bug Fix] (config) Modify the implementation logic about 'git diff' by git tag, doesn't by git branch. --- scripts/ci/build_git-tag_or_create_github-release.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/ci/build_git-tag_or_create_github-release.sh b/scripts/ci/build_git-tag_or_create_github-release.sh index 5ea2a92e..5a4a6cfb 100644 --- a/scripts/ci/build_git-tag_or_create_github-release.sh +++ b/scripts/ci/build_git-tag_or_create_github-release.sh @@ -294,7 +294,16 @@ elif [ "$Input_Arg_Release_Type" == 'github-action-reusable-workflow' ]; then git remote -v echo "🔬 📄 🌳 ⛓ 🌳 Check the different of '.github/release-notes.md' between current git branch and master branch ..." - release_notes_has_diff=$(git diff origin/master "$Current_Branch" -- .github/release-notes.md | cat) + # # v1: compare by git branches +# release_notes_has_diff=$(git diff origin/master "$Current_Branch" -- .github/release-notes.md | cat) + # # v2: compare by git tag + all_git_tags=$(git tag -l | cat) + declare -a all_git_tags_array=( $(echo "$all_git_tags" | awk -v RS='' '{gsub("\n"," "); print}') ) + all_git_tags_array_len=${#all_git_tags_array[@]} + latest_git_tag=${all_git_tags_array[$all_git_tags_array_len - 1]} + echo "🔎 🌳 🏷 The latest git tag: $latest_git_tag" + + release_notes_has_diff=$(git diff "$latest_git_tag" "$Current_Branch" -- .github/release-notes.md | cat) echo "🔎 🔬 📄 different of '.github/release-notes.md': $release_notes_has_diff" if [ "$release_notes_has_diff" != "" ]; then From fd3a4bb9c582428a473784150fcf13f8355733e5 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Fri, 2 Sep 2022 10:18:33 +0800 Subject: [PATCH 2/4] [Test] (config) Test for comparing code by git tag. --- scripts/ci/build_git-tag_or_create_github-release.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/ci/build_git-tag_or_create_github-release.sh b/scripts/ci/build_git-tag_or_create_github-release.sh index 5a4a6cfb..99dc243f 100644 --- a/scripts/ci/build_git-tag_or_create_github-release.sh +++ b/scripts/ci/build_git-tag_or_create_github-release.sh @@ -131,6 +131,9 @@ git_global_user_email=$(git config --global user.email) echo "🔎 🌳 Current git name: $git_global_username" echo "🔎 🌳 Current git email: $git_global_user_email" +git pull +echo "📩 🌳 git pull done" + declare Tag_Version # This is the return value of function 'get_latest_version_by_git_tag' get_latest_version_by_git_tag() { # # # # The types to get version by tag: 'git' or 'github' From ad864ae263f6eec227f77c5a89594589c95b66ab Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Fri, 2 Sep 2022 13:49:58 +0800 Subject: [PATCH 3/4] [Bug Fix] (config) Fix the issue about regx of searching command. --- .github/workflows/build_git-tag_and_create_github-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_git-tag_and_create_github-release.yaml b/.github/workflows/build_git-tag_and_create_github-release.yaml index 8d2c629d..2371ed59 100644 --- a/.github/workflows/build_git-tag_and_create_github-release.yaml +++ b/.github/workflows/build_git-tag_and_create_github-release.yaml @@ -93,7 +93,7 @@ jobs: release=$(bash ./scripts/ci/build_git-tag_or_create_github-release.sh ${{ inputs.project_type }} ${{ inputs.debug_mode }}) echo "📄 Release log: $release" - release_version=$(echo "$release" | grep -E "\[GitHub Action - Reusable workflow\] \[Final Running Result\] Official-Release and version: ([0-9]{1,})" | grep -E -o "([0-9]{1,})") + release_version=$(echo "$release" | grep -E "\[GitHub Action - Reusable workflow\] \[Final Running Result\] (Official\-Release and version: ([0-9]{1,})|(Pre\-Release))" | grep -E -o "([0-9]{1,})") echo "🤖 Release Version: $release_version" echo "::set-output name=release_version::$(echo $release_version)" From 726e1a2924ad32e25cda17fae73d73df7fd5c07b Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Fri, 2 Sep 2022 13:52:56 +0800 Subject: [PATCH 4/4] [Bug Fix] (config) Fix the issue about regx of searching command. --- .github/workflows/build_git-tag_and_create_github-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_git-tag_and_create_github-release.yaml b/.github/workflows/build_git-tag_and_create_github-release.yaml index 2371ed59..d989fbff 100644 --- a/.github/workflows/build_git-tag_and_create_github-release.yaml +++ b/.github/workflows/build_git-tag_and_create_github-release.yaml @@ -93,7 +93,7 @@ jobs: release=$(bash ./scripts/ci/build_git-tag_or_create_github-release.sh ${{ inputs.project_type }} ${{ inputs.debug_mode }}) echo "📄 Release log: $release" - release_version=$(echo "$release" | grep -E "\[GitHub Action - Reusable workflow\] \[Final Running Result\] (Official\-Release and version: ([0-9]{1,})|(Pre\-Release))" | grep -E -o "([0-9]{1,})") + release_version=$(echo "$release" | grep -E "\[GitHub Action - Reusable workflow\] \[Final Running Result\] (Official\-Release and version: ([0-9]{1,})|(Pre\-Release))" | grep -E -o "(([0-9]{1,})|(Pre\-Release))") echo "🤖 Release Version: $release_version" echo "::set-output name=release_version::$(echo $release_version)"