ci: make Hugo download resilient
Some checks failed
Deploy Hugo Blog to k3s / build-and-deploy (push) Failing after 1m36s

This commit is contained in:
root
2026-06-02 05:58:36 +08:00
parent cd4b859744
commit cc1f554dec

View File

@@ -27,11 +27,6 @@ jobs:
uses: actions/checkout@v4
- name: Setup Hugo
env:
HTTP_PROXY: http://10.0.2.2:7890
HTTPS_PROXY: http://10.0.2.2:7890
ALL_PROXY: socks5://10.0.2.2:7891
NO_PROXY: localhost,127.0.0.1,.svc,.cluster.local,gitea-http.gitea.svc.cluster.local,git.luochen570.cn,docker.gitea.com
run: |
set -euo pipefail
HUGO_VERSION="0.161.1"
@@ -43,9 +38,26 @@ jobs:
exit 0
fi
curl -fsSLo "/tmp/${HUGO_DEB}" "$HUGO_URL"
apt-get update
apt-get install -y --no-install-recommends "/tmp/${HUGO_DEB}"
download_hugo() {
local proxy_name="$1"
shift
echo "Trying Hugo download via ${proxy_name}"
env "$@" curl -fsSL --connect-timeout 20 --retry 2 --retry-delay 3 \
-o "/tmp/${HUGO_DEB}" "$HUGO_URL"
}
download_hugo "direct" \
HTTP_PROXY= HTTPS_PROXY= ALL_PROXY= http_proxy= https_proxy= all_proxy= \
|| download_hugo "localhost mihomo" \
HTTP_PROXY=http://127.0.0.1:7890 HTTPS_PROXY=http://127.0.0.1:7890 ALL_PROXY=socks5://127.0.0.1:7891 \
http_proxy=http://127.0.0.1:7890 https_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7891 \
NO_PROXY=localhost,127.0.0.1,.svc,.cluster.local,gitea-http.gitea.svc.cluster.local,git.luochen570.cn,docker.gitea.com \
|| download_hugo "rootless gateway mihomo" \
HTTP_PROXY=http://10.0.2.2:7890 HTTPS_PROXY=http://10.0.2.2:7890 ALL_PROXY=socks5://10.0.2.2:7891 \
http_proxy=http://10.0.2.2:7890 https_proxy=http://10.0.2.2:7890 all_proxy=socks5://10.0.2.2:7891 \
NO_PROXY=localhost,127.0.0.1,.svc,.cluster.local,gitea-http.gitea.svc.cluster.local,git.luochen570.cn,docker.gitea.com
dpkg -i "/tmp/${HUGO_DEB}"
hugo version
- name: Hugo Build