1+ name : Check for Docker image updates
2+
3+ on :
4+ workflow_dispatch :
5+ schedule :
6+ - cron : " 0 * * * *"
7+
8+ jobs :
9+ check-updates :
10+ runs-on : ubuntu-latest
11+ outputs :
12+ updates : ${{ steps.check-updates.outputs.updates }}
13+
14+ steps :
15+ - name : Download previous state
16+ uses : actions/download-artifact@v3
17+ continue-on-error : true
18+ with :
19+ name : last-checked-versions
20+ path : .github/
21+
22+ - name : Check for updates
23+ id : check-updates
24+ run : |
25+ declare -A repos=(
26+ ["litefs"]="https://github.com/superfly/litefs.git refs/tags/"
27+ ["wireproxy"]="https://github.com/whyvl/wireproxy.git"
28+ ["nginx-ssl-ja3"]="https://github.com/fooinha/nginx-ssl-ja3.git"
29+ ["ingress-nginx"]="https://github.com/kubernetes/ingress-nginx.git refs/tags/controller"
30+ ["samba"]="https://github.com/samba-team/samba.git refs/tags/"
31+ ["stolon"]="https://github.com/sorintlab/stolon.git refs/tags/"
32+ ["nitter"]="https://github.com/zedeus/nitter.git"
33+ ["tor"]="https://github.com/m0wer/docker-tor.git"
34+ ["stash"]="https://github.com/stashed/stash.git refs/tags/"
35+ ["logrotate"]="https://github.com/blacklabelops/logrotate.git"
36+ ["cert-manager-webhook-powerdns"]="https://github.com/lordofsystem/cert-manager-webhook-powerdns.git"
37+ ["nginx-ssl-fingerprint"]="https://github.com/phuslu/nginx-ssl-fingerprint.git"
38+ )
39+
40+ updates=""
41+ mkdir -p .github/versions
42+
43+ for repo in "${!repos[@]}"; do
44+ if [[ "${repos[$repo]}" == *"refs/tags/"* ]]; then
45+ latest=$(git ls-remote --refs --tags ${repos[$repo]%% *} | sort -t '/' -k 3 -V | tail -n1)
46+ else
47+ latest=$(git ls-remote ${repos[$repo]} | head -n1)
48+ fi
49+
50+ if [ -f ".github/versions/${repo}" ]; then
51+ previous=$(cat ".github/versions/${repo}")
52+ if [ "$latest" != "$previous" ]; then
53+ updates="${updates}${repo},"
54+ fi
55+ else
56+ updates="${updates}${repo},"
57+ fi
58+ echo "$latest" > ".github/versions/${repo}"
59+ done
60+
61+ if [ ! -z "$updates" ]; then
62+ updates=${updates%,}
63+ echo "updates=${updates}" >> $GITHUB_OUTPUT
64+ fi
65+
66+ - name : Upload new state
67+ uses : actions/upload-artifact@v3
68+ with :
69+ name : last-checked-versions
70+ path : .github/versions/
71+ retention-days : 1
72+
73+ trigger-workflows :
74+ needs : check-updates
75+ if : needs.check-updates.outputs.updates != ''
76+ runs-on : ubuntu-latest
77+
78+ steps :
79+ - name : Trigger relevant workflows
80+ run : |
81+ IFS=',' read -ra UPDATES <<< "${{ needs.check-updates.outputs.updates }}"
82+ for repo in "${UPDATES[@]}"; do
83+ case $repo in
84+ "litefs")
85+ gh workflow run docker-build-litefs-patched.yaml
86+ ;;
87+ "wireproxy")
88+ gh workflow run docker-build-wireproxy-debian.yml
89+ ;;
90+ "nginx-ssl-ja3")
91+ gh workflow run docker-build-openresty-ssl-ja3.yml
92+ ;;
93+ "ingress-nginx")
94+ gh workflow run docker-build-ingress-nginx.yml
95+ gh workflow run docker-build-ingress-nginx-controller-dynamic-modules.yml
96+ gh workflow run docker-build-ingress-nginx-custom.yml
97+ ;;
98+ "samba")
99+ gh workflow run docker-build-samba.yml
100+ ;;
101+ "stolon")
102+ gh workflow run docker-build-stolon.yml
103+ ;;
104+ "nitter")
105+ gh workflow run docker-build-nitter-patched.yml
106+ ;;
107+ "tor")
108+ gh workflow run docker-build-tor-single-hop.yml
109+ ;;
110+ "stash")
111+ gh workflow run docker-build-stash.yml
112+ ;;
113+ "logrotate")
114+ gh workflow run docker-build-logrotate.yml
115+ ;;
116+ "cert-manager-webhook-powerdns")
117+ gh workflow run docker-build-cert-manager-webhook-powerdns.yml
118+ ;;
119+ "nginx-ssl-fingerprint")
120+ gh workflow run docker-build-nginx-ssl-fingerprint.yml
121+ ;;
122+ esac
123+ done
124+ env :
125+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments