-
Notifications
You must be signed in to change notification settings - Fork 10
109 lines (88 loc) · 3.86 KB
/
check_new_release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: check for new releases iperf3
on:
workflow_dispatch:
inputs:
force_build:
description: "Force a build"
required: false
default: false
type: boolean
schedule:
- cron: "*/30 */1 * * *"
permissions:
actions: write
contents: write
env:
GH_TOKEN: "${{ github.TOKEN }}"
jobs:
skip_duplicate_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: "always"
cancel_others: "false"
skip_after_successful_duplicate: false
do_not_skip: ""
check_release:
if: ${{ needs.skip_duplicate_job.outputs.should_skip != 'true' }}
needs: skip_duplicate_job
outputs:
continue_build: ${{ steps.continue_build.outputs.continue_build }}
runs-on: ubuntu-latest
name: "Check for latest iperf3 tags"
env:
continue_build: "no"
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v4
- name: Force build by setting custom tag to compare
if: ${{ github.event.inputs.force_build == 'true' }}
run: |
echo "upstream_iperf3_tag=99.99.99" >> $GITHUB_ENV
- name: Get latest esnet/iperf tag
if: ${{ github.event.inputs.force_build == 'false' }}
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 ${{ github.repository }} tag
run: echo "local_iperf3_tag=$(git ls-remote -q -t --refs "https://github.com/${{ github.repository }}.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: |
ver() {
local test_array
read -ra test_array < <(printf "%s" "${@//./ }")
printf "%d%03d%03d%03d" "${test_array[@]}"
}
local_iperf3_tag="${{ env.local_iperf3_tag }}"
if [[ "$(ver "${{ env.upstream_iperf3_tag }}")" -gt "$(ver "${local_iperf3_tag//+/}")" ]]; then
printf "%-14s remote:%-10s local:%-10s %s\n" "$iray" "${{ env.upstream_iperf3_tag }}" "${local_iperf3_tag//+/}" "< New version available - workflow will be triggered"
echo "continue_build=yes" >> $GITHUB_ENV
else
printf "%-14s remote:%-10s local:%-10s\n" "$iray" "${{ env.upstream_iperf3_tag }}" "${local_iperf3_tag//+/}"
fi
echo "continue_build=${{ env.continue_build }}" >> $GITHUB_OUTPUT
- name: gh cli trigger and watch local workflow alpine_multi.yml
if: env.continue_build == 'yes'
run: |
workflow_run_id=""
workflow_run_name="alpine_multi.yml"
gh workflow run "${workflow_run_name}"
while [[ -z "$workflow_run_id" ]]; do
workflow_run_id=$(gh run list -w "${workflow_run_name}" -s "in_progress" -L 1 --json databaseId -q '.[].databaseId')
done
gh run watch "${workflow_run_id}" -i 5 --exit-status
- name: gh cli trigger and watch local workflow cygwin_cmd.yml
if: env.continue_build == 'yes'
run: |
workflow_run_id=""
workflow_run_name="cygwin_cmd.yml"
gh workflow run "${workflow_run_name}"
while [[ -z "$workflow_run_id" ]]; do
workflow_run_id=$(gh run list -w "${workflow_run_name}" -s "in_progress" -L 1 --json databaseId -q '.[].databaseId')
done
gh run watch "${workflow_run_id}" -i 5 --exit-status