Compare commits

...

2 Commits

Author SHA1 Message Date
cbf2aa37fd 阿里云仓库同步
Some checks failed
阿里云仓库同步流水线 / sync-repositories (push) Failing after 15s
BladeX仓库同步流水线 / sync-repositories (push) Failing after 31m51s
2025-12-24 10:29:48 +08:00
166223ef3f 调整名称 2025-12-24 10:23:46 +08:00
4 changed files with 95 additions and 4 deletions

View File

@@ -0,0 +1,84 @@
name: 阿里云仓库同步流水线
on:
push:
branches:
- master
paths:
- 'aliyun_repos.yaml'
- '.gitea/workflows/aliyun-repo-sync.yml'
workflow_dispatch:
schedule:
# 每天凌晨2点执行
- cron: '0 2 * * 0'
env:
CONFIG_FILE: 'aliyun_repos.yaml'
jobs:
sync-repositories:
runs-on: ubuntu-latest
steps:
- name: 签出配置仓库
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: 配置 Git
run: |
git config --global user.name "gitea-runner"
git config --global user.email "actions@gitea.fjy8018.top"
git config --global init.defaultBranch master
- name: 安装依赖
run: |
apt-get update
apt-get install -y python3-yaml jq
- name: 验证配置文件
run: |
if [ ! -f "${{ env.CONFIG_FILE }}" ]; then
echo "错误: 配置文件 ${{ env.CONFIG_FILE }} 不存在!"
exit 1
fi
echo "✓ 配置文件已找到"
- name: 网络连通性诊断
run: |
echo "================================================================================"
echo "网络连通性诊断"
echo "================================================================================"
echo ""
echo "[1] 检查DNS解析 (center.javablade.com):"
if command -v nslookup >/dev/null 2>&1; then
nslookup center.javablade.com || echo "❌ nslookup 失败"
elif command -v dig >/dev/null 2>&1; then
dig center.javablade.com || echo "❌ dig 失败"
else
getent hosts center.javablade.com || echo "❌ DNS 解析失败"
fi
echo ""
echo "[2] 检查网络连通性:"
if command -v ping >/dev/null 2>&1; then
ping -c 3 -W 5 center.javablade.com || echo "❌ ping 失败"
else
echo "⚠️ ping 命令不可用,跳过连通性测试"
fi
echo ""
echo "[3] 检查是否可以访问上游仓库(匿名测试):"
if command -v git >/dev/null 2>&1; then
timeout 30 git ls-remote https://center.javablade.com/blade/aliyun-Tool.git HEAD || echo "❌ 无法访问仓库"
else
echo "⚠️ git 命令不可用"
fi
echo ""
echo "================================================================================"
- name: 从配置文件中提取仓库并同步
env:
UPSTREAM_USERNAME: ${{ secrets.UPSTREAM_USERNAME }}
UPSTREAM_TOKEN: ${{ secrets.UPSTREAM_TOKEN }}
TARGET_USERNAME: ${{ secrets.TARGET_USERNAME }}
TARGET_TOKEN: ${{ secrets.TARGET_TOKEN }}
run: python3 sync_repos.py

View File

@@ -1,19 +1,19 @@
name: 仓库同步流水线
name: BladeX仓库同步流水线
on:
push:
branches:
- master
paths:
- 'repos.yaml'
- '.gitea/workflows/*.yml'
- 'bladex_repos.yaml'
- '.gitea/workflows/bladex-repo-sync.yml'
workflow_dispatch:
schedule:
# 每天凌晨1点执行
- cron: '0 1 * * 0'
env:
CONFIG_FILE: 'repos.yaml'
CONFIG_FILE: 'bladex_repos.yaml'
jobs:
sync-repositories:

7
aliyun_repos.yaml Normal file
View File

@@ -0,0 +1,7 @@
# 多仓库同步配置文件
# 定义需要同步的仓库对,源仓库 -> 目标仓库
repositories:
- name: "pve-k3s-gitops"
source_url: "https://${CODEUP_USERNAME}:${CODEUP_PASSWORD}@codeup.aliyun.com/619ddf2bcfe94d7ade4c41ab/fjy8018/pve-k3s-gitops.git"
target_url: "https://${TARGET_USERNAME}:${TARGET_TOKEN}@gitea.fjy8018.top/fjy8018/pve-k3s-gitops.git"
branch: "master"