From 084020668d5d2f0527011f8825243282b2c946a8 Mon Sep 17 00:00:00 2001 From: hu xiaotong <416314413@163.com> Date: Thu, 26 Jun 2025 13:21:33 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=B7=BB=E5=8A=A0=20Gitea=20Actions=20?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 ci.yaml 文件,定义 Gitea Actions 示例 --- .gitea/workflows/ci.yaml | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 7716204..b99e536 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -26,13 +26,37 @@ jobs: else echo "📥 下载并安装Go..." - # 下载Go 1.22 + # 下载Go 1.22 - 使用国内镜像 GO_VERSION="1.22.0" GO_ARCH="linux-amd64" - GO_URL="https://go.dev/dl/go${GO_VERSION}.${GO_ARCH}.tar.gz" - echo "下载Go ${GO_VERSION}..." - wget -q ${GO_URL} -O go.tar.gz + # 尝试多个国内镜像源 + MIRRORS=( + "https://golang.google.cn/dl/go${GO_VERSION}.${GO_ARCH}.tar.gz" + "https://mirrors.aliyun.com/golang/go${GO_VERSION}.${GO_ARCH}.tar.gz" + "https://mirrors.huaweicloud.com/golang/go${GO_VERSION}.${GO_ARCH}.tar.gz" + "https://mirrors.tencent.com/go/go${GO_VERSION}.${GO_ARCH}.tar.gz" + "https://go.dev/dl/go${GO_VERSION}.${GO_ARCH}.tar.gz" + ) + + DOWNLOAD_SUCCESS=false + + for mirror in "${MIRRORS[@]}"; do + echo "尝试从镜像下载: $mirror" + if wget -q --timeout=30 --tries=3 "$mirror" -O go.tar.gz; then + echo "✅ 下载成功: $mirror" + DOWNLOAD_SUCCESS=true + break + else + echo "❌ 下载失败: $mirror" + continue + fi + done + + if [ "$DOWNLOAD_SUCCESS" = false ]; then + echo "❌ 所有镜像源下载失败" + exit 1 + fi # 解压到/usr/local echo "解压Go到/usr/local..."