1
- name : Timely assets update
1
+ name : Scheduled assets update
2
2
3
3
# NOTE: This Github Actions is required by other actions, for preparing other packaging assets in a
4
4
# routine manner, for example: GeoIP/GeoSite.
@@ -8,19 +8,20 @@ name: Timely assets update
8
8
on :
9
9
workflow_dispatch :
10
10
schedule :
11
- # Update assets on every hour (xx :30)
12
- - cron : ' 30 * * * *'
11
+ # Update GeoData on every day (22 :30 UTC )
12
+ - cron : ' 30 22 * * *'
13
13
push :
14
14
# Prevent triggering update request storm
15
15
paths :
16
- - " .github/workflows/hourly-prepare .yml"
16
+ - " .github/workflows/scheduled-assets-update .yml"
17
17
pull_request :
18
18
# Prevent triggering update request storm
19
19
paths :
20
- - " .github/workflows/hourly-prepare .yml"
20
+ - " .github/workflows/scheduled-assets-update .yml"
21
21
22
22
jobs :
23
23
geodat :
24
+ if : github.event.schedule == '30 22 * * *' || github.event_name == 'push'|| github.event_name == 'pull_request'
24
25
runs-on : ubuntu-latest
25
26
steps :
26
27
- name : Restore Geodat Cache
@@ -38,18 +39,18 @@ jobs:
38
39
max_attempts : 60
39
40
command : |
40
41
[ -d 'resources' ] || mkdir resources
41
- LIST=('v2ray-rules-dat geoip geoip' 'v2ray-rules-dat geosite geosite')
42
+ LIST=('Loyalsoldier v2ray-rules-dat geoip geoip' 'Loyalsoldier v2ray-rules-dat geosite geosite')
42
43
for i in "${LIST[@]}"
43
44
do
44
- INFO=($(echo $i | awk 'BEGIN{FS=" ";OFS=" "} {print $1,$2,$3}'))
45
- FILE_NAME="${INFO[2 ]}.dat"
45
+ INFO=($(echo $i | awk 'BEGIN{FS=" ";OFS=" "} {print $1,$2,$3,$4 }'))
46
+ FILE_NAME="${INFO[3 ]}.dat"
46
47
echo -e "Verifying HASH key..."
47
- HASH="$(curl -sL "https://raw.githubusercontent.com/Loyalsoldier/ ${INFO[0]}/release/${INFO[1 ]}.dat.sha256sum" | awk -F ' ' '{print $1}')"
48
+ HASH="$(curl -sL "https://raw.githubusercontent.com/${INFO[0]}/${INFO[1]}/ release/${INFO[2 ]}.dat.sha256sum" | awk -F ' ' '{print $1}')"
48
49
if [ -s "./resources/${FILE_NAME}" ] && [ "$(sha256sum "./resources/${FILE_NAME}" | awk -F ' ' '{print $1}')" == "${HASH}" ]; then
49
50
continue
50
51
else
51
- echo -e "Downloading https://raw.githubusercontent.com/Loyalsoldier/ ${INFO[0]}/release/${INFO[1 ]}.dat..."
52
- curl -L "https://raw.githubusercontent.com/Loyalsoldier/ ${INFO[0]}/release/${INFO[1 ]}.dat" -o ./resources/${FILE_NAME}
52
+ echo -e "Downloading https://raw.githubusercontent.com/${INFO[0]}/${INFO[1]}/ release/${INFO[2 ]}.dat..."
53
+ curl -L "https://raw.githubusercontent.com/${INFO[0]}/${INFO[1]}/ release/${INFO[2 ]}.dat" -o ./resources/${FILE_NAME}
53
54
echo -e "Verifying HASH key..."
54
55
[ "$(sha256sum "./resources/${FILE_NAME}" | awk -F ' ' '{print $1}')" == "${HASH}" ] || { echo -e "The HASH key of ${FILE_NAME} does not match cloud one."; exit 1; }
55
56
echo "unhit=true" >> $GITHUB_OUTPUT
0 commit comments