From 62fbba8efbf0d54e0db982bc5b2f84775b14b6d2 Mon Sep 17 00:00:00 2001 From: userdocs <16525024+userdocs@users.noreply.github.com> Date: Wed, 22 Feb 2023 03:32:44 +0000 Subject: [PATCH] Update check_new_release.yml --- .github/workflows/check_new_release.yml | 29 +++++++------------------ 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/.github/workflows/check_new_release.yml b/.github/workflows/check_new_release.yml index 74ec878..10d70da 100644 --- a/.github/workflows/check_new_release.yml +++ b/.github/workflows/check_new_release.yml @@ -37,39 +37,26 @@ jobs: steps: - name: Get latest esnet/iperf tag - run: | - cat > "upstream_iperf3_tag.sh" <<- UPSTREAM_IPERF3_TAG - declare -A upstream_iperf3_tag - upstream_iperf3_tag[iperf3]="$(git ls-remote -q -t --refs "https://github.com/esnet/iperf.git" | awk '{sub("refs/tags/", "");sub("(.*)(-|rc|iperf|trunk|3.1b1|3.1b2|3.1b3)(.*)", ""); print $2 }' | awk '!/^$/' | sort -rV | head -n1)" - UPSTREAM_IPERF3_TAG + run: echo "upstream_iperf3_tag=$(git ls-remote -q -t --refs "https://github.com/esnet/iperf.git" | awk '{sub("refs/tags/", "");sub("(.*)(-|rc|iperf|trunk|3.1b1|3.1b2|3.1b3)(.*)", ""); print $2 }' | awk '!/^$/' | sort -rV | head -n1)" >> $GITHUB_ENV - name: Get latest userdocs/iperf3-static tag - run: | - cat > "local_iperf3_tag.sh" <<- LOCAL_IPERF3_TAG - declare -A local_iperf3_tag - local_iperf3_tag[iperf3]="$(git ls-remote -q -t --refs "https://github.com/userdocs/iperf3-static.git" | awk '{sub("refs/tags/", "");sub("(.*)(-|rc|iperf|trunk|3.1b1|3.1b2|3.1b3)(.*)", ""); print $2 }' | awk '!/^$/' | sort -rV | head -n1)" - LOCAL_IPERF3_TAG + run: echo "local_iperf3_tag=$(git ls-remote -q -t --refs "https://github.com/userdocs/iperf3-static.git" | awk '{sub("refs/tags/", "");sub("(.*)(-|rc|iperf|trunk|3.1b1|3.1b2|3.1b3)(.*)", ""); print $2 }' | awk '!/^$/' | sort -rV | head -n1)" >> $GITHUB_ENV - name: Test values - latest upstream vs local tags id: continue_build run: | - source upstream_iperf3_tag.sh - source local_iperf3_tag.sh - ver() { local test_array read -ra test_array < <(printf "%s" "${@//./ }") printf "%d%03d%03d%03d" "${test_array[@]}" } - for iray in "${!upstream_iperf3_tag[@]}"; do - if [[ "$(ver "${upstream_iperf3_tag[$iray]}")" -gt "$(ver "${local_iperf3_tag[$iray]}")" ]]; then - printf "%-14s latest:%-10s iperf3-static:%-10s %s\n" "$iray" "${upstream_iperf3_tag[$iray]}" "${local_iperf3_tag[$iray]}" "< New version available - workflow will be triggered" - echo "continue_build=yes" >> $GITHUB_ENV - else - printf "%-14s latest:%-10s iperf3-static:%-10s\n" "$iray" "${upstream_iperf3_tag[$iray]}" "${local_iperf3_tag[$iray]}" - fi - done + if [[ "$(ver "${{ env.upstream_iperf3_tag }}")" -gt "$(ver "${{ env.local_iperf3_tag }}")" ]]; then + printf "%-14s latest:%-10s iperf3-static:%-10s %s\n" "$iray" "${{ env.upstream_iperf3_tag }}" "${{ env.local_iperf3_tag }}" "< New version available - workflow will be triggered" + echo "continue_build=yes" >> $GITHUB_ENV + else + printf "%-14s latest:%-10s iperf3-static:%-10s\n" "$iray" "${{ env.upstream_iperf3_tag }}" "${{ env.local_iperf3_tag }}" + fi echo "continue_build=${{ env.continue_build }}" >> $GITHUB_OUTPUT