multi repo support
This commit is contained in:
58
.gitea/workflows/sync_A_to_B.yml
Normal file
58
.gitea/workflows/sync_A_to_B.yml
Normal file
@@ -0,0 +1,58 @@
|
||||
name: "同步 A → B"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- 'configs/A_to_B.yaml'
|
||||
- 'scripts/sync_tool.py'
|
||||
- '.gitea/workflows/sync_A_to_B.yml'
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
# 每天凌晨2点执行
|
||||
- cron: '0 2 * * *'
|
||||
|
||||
env:
|
||||
CONFIG_FILE: 'configs/A_to_B.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
|
||||
|
||||
- name: 验证配置文件
|
||||
run: |
|
||||
if [ ! -f "${{ env.CONFIG_FILE }}" ]; then
|
||||
echo "错误: 配置文件 ${{ env.CONFIG_FILE }} 不存在!"
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ 配置文件已找到: ${{ env.CONFIG_FILE }}"
|
||||
|
||||
- name: 执行同步 A → B
|
||||
env:
|
||||
SYNC_A_B_USERNAME: ${{ secrets.SYNC_A_B_USERNAME }}
|
||||
SYNC_A_B_TOKEN: ${{ secrets.SYNC_A_B_TOKEN }}
|
||||
run: |
|
||||
echo "================================================================================"
|
||||
echo "开始同步: A → B"
|
||||
echo "使用配置: ${{ env.CONFIG_FILE }}"
|
||||
echo "环境前缀: SYNC_A_B"
|
||||
echo "================================================================================"
|
||||
python3 scripts/sync_tool.py ${{ env.CONFIG_FILE }} --env-prefix SYNC_A_B
|
||||
58
.gitea/workflows/sync_B_to_C.yml
Normal file
58
.gitea/workflows/sync_B_to_C.yml
Normal file
@@ -0,0 +1,58 @@
|
||||
name: "同步 B → C"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- 'configs/B_to_C.yaml'
|
||||
- 'scripts/sync_tool.py'
|
||||
- '.gitea/workflows/sync_B_to_C.yml'
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
# 每天凌晨3点执行(在 A→B 之后)
|
||||
- cron: '0 3 * * *'
|
||||
|
||||
env:
|
||||
CONFIG_FILE: 'configs/B_to_C.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
|
||||
|
||||
- name: 验证配置文件
|
||||
run: |
|
||||
if [ ! -f "${{ env.CONFIG_FILE }}" ]; then
|
||||
echo "错误: 配置文件 ${{ env.CONFIG_FILE }} 不存在!"
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ 配置文件已找到: ${{ env.CONFIG_FILE }}"
|
||||
|
||||
- name: 执行同步 B → C
|
||||
env:
|
||||
SYNC_B_C_USERNAME: ${{ secrets.SYNC_B_C_USERNAME }}
|
||||
SYNC_B_C_TOKEN: ${{ secrets.SYNC_B_C_TOKEN }}
|
||||
run: |
|
||||
echo "================================================================================"
|
||||
echo "开始同步: B → C"
|
||||
echo "使用配置: ${{ env.CONFIG_FILE }}"
|
||||
echo "环境前缀: SYNC_B_C"
|
||||
echo "================================================================================"
|
||||
python3 scripts/sync_tool.py ${{ env.CONFIG_FILE }} --env-prefix SYNC_B_C
|
||||
Reference in New Issue
Block a user