+15
-11
@@ -9,25 +9,29 @@ jobs:
|
||||
run: |
|
||||
set -e
|
||||
|
||||
# ========== 1. 换 apt 国内源(清华,Ubuntu 22.04 jammy) ==========
|
||||
cp /etc/apt/sources.list /etc/apt/sources.list.bak
|
||||
# ========== 1. 清空所有 apt 源,只留腾讯云 ==========
|
||||
# 备份
|
||||
mkdir -p /etc/apt/backup
|
||||
cp -r /etc/apt/sources.list* /etc/apt/backup/ 2>/dev/null || true
|
||||
|
||||
# 删除 sources.list.d 下所有额外源(微软 / git PPA / git-lfs 等)
|
||||
rm -f /etc/apt/sources.list.d/*
|
||||
|
||||
# 清空主 sources.list,写入腾讯云 noble(24.04)源
|
||||
cat > /etc/apt/sources.list <<'EOF'
|
||||
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
|
||||
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
|
||||
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
|
||||
deb https://mirrors.cloud.tencent.com/ubuntu/ noble main restricted universe multiverse
|
||||
deb https://mirrors.cloud.tencent.com/ubuntu/ noble-updates main restricted universe multiverse
|
||||
deb https://mirrors.cloud.tencent.com/ubuntu/ noble-security main restricted universe multiverse
|
||||
deb https://mirrors.cloud.tencent.com/ubuntu/ noble-backports main restricted universe multiverse
|
||||
EOF
|
||||
|
||||
apt-get update
|
||||
apt-get install -y golang-go git nodejs npm
|
||||
|
||||
# ========== 2. 配置 Go 国内源 ==========
|
||||
# 七牛 goproxy.cn(国内最快之一)
|
||||
go env -w GOPROXY=https://goproxy.cn,direct
|
||||
# 同时关掉校验 sumdb 的境外访问(可选)
|
||||
go env -w GOSUMDB=sum.golang.org
|
||||
go env -w GONOSUMCHECK=1
|
||||
# 如果私有仓库,可加(按需)
|
||||
# go env -w GOPRIVATE=git.yourdomain.com
|
||||
go env -w GOSUMDB=off
|
||||
# go env -w GOPRIVATE=git.yourdomain.com # 私有仓库按需开
|
||||
|
||||
# ========== 3. 配置 npm 国内源 ==========
|
||||
npm config set registry https://registry.npmmirror.com
|
||||
|
||||
Reference in New Issue
Block a user