ci: support both apt sources formats for mirror switching
All checks were successful
Build Backend / build (push) Successful in 2m5s
Build Backend / build-docker (push) Successful in 2m19s

Update the CI workflow to handle both the legacy sources.list format
and the new ubuntu.sources format when switching to Tsinghua mirrors
This commit is contained in:
lafay
2026-04-27 23:28:54 +08:00
parent 496a0103ea
commit 8b1e411c89

View File

@@ -36,8 +36,13 @@ jobs:
- name: Install build tools
run: |
if [ -f /etc/apt/sources.list.d/ubuntu.sources ]; then
sudo sed -i 's|http://archive.ubuntu.com/ubuntu|https://mirrors.tuna.tsinghua.edu.cn/ubuntu|g' /etc/apt/sources.list.d/ubuntu.sources
sudo sed -i 's|http://security.ubuntu.com/ubuntu|https://mirrors.tuna.tsinghua.edu.cn/ubuntu|g' /etc/apt/sources.list.d/ubuntu.sources
else
sudo sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list
sudo sed -i 's|http://security.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list
fi
sudo apt-get update && sudo apt-get install -y gcc
- name: Download dependencies