Skip to content

Commit

Permalink
Update check_new_release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
userdocs committed Feb 22, 2023
1 parent a931b86 commit 62fbba8
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions .github/workflows/check_new_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 62fbba8

Please sign in to comment.