ci(sync): update sync workflow remote configuration
- add explicit `ssh-host` field to remote matrix entries for clarity - update ssh-keyscan and git remote commands to use `ssh-host` instead of `name` - rename remote identifiers in matrix from domain names to platform names
This commit is contained in:
parent
2792006d21
commit
9d8ad43a26
|
|
@ -23,10 +23,12 @@ jobs:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
remote:
|
remote:
|
||||||
- name: codeberg.org
|
- name: Codeberg
|
||||||
|
ssh-host: codeberg.org
|
||||||
ssh-url: git@codeberg.org:pooneyy/1Panel-Appstore.git
|
ssh-url: git@codeberg.org:pooneyy/1Panel-Appstore.git
|
||||||
https-url: https://codeberg.org/pooneyy/1Panel-Appstore
|
https-url: https://codeberg.org/pooneyy/1Panel-Appstore
|
||||||
- name: gitea.com
|
- name: Gitea
|
||||||
|
ssh-host: gitea.com
|
||||||
ssh-url: git@gitea.com:pooneyy/1Panel-Appstore.git
|
ssh-url: git@gitea.com:pooneyy/1Panel-Appstore.git
|
||||||
https-url: https://gitea.com/pooneyy/1Panel-Appstore
|
https-url: https://gitea.com/pooneyy/1Panel-Appstore
|
||||||
|
|
||||||
|
|
@ -49,14 +51,14 @@ jobs:
|
||||||
- name: 添加目标主机的公钥
|
- name: 添加目标主机的公钥
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
ssh-keyscan ${{ matrix.remote.name }} >> ~/.ssh/known_hosts
|
ssh-keyscan ${{ matrix.remote.ssh-host }} >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
- name: 配置本地仓库
|
- name: 配置本地仓库
|
||||||
run: |
|
run: |
|
||||||
git config --global --add safe.directory ${{ github.workspace }}
|
git config --global --add safe.directory ${{ github.workspace }}
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
git config user.email ${{ secrets.SYNC_EMAIL }}
|
git config user.email ${{ secrets.SYNC_EMAIL }}
|
||||||
git remote add ${{ matrix.remote.name }} ${{ matrix.remote.ssh-url }}
|
git remote add ${{ matrix.remote.ssh-host }} ${{ matrix.remote.ssh-url }}
|
||||||
git branch -r | grep -v '\->' | while read remote; do
|
git branch -r | grep -v '\->' | while read remote; do
|
||||||
branch=${remote#origin/}
|
branch=${remote#origin/}
|
||||||
git branch --track "$branch" "$remote" 2>/dev/null && echo "创建本地分支: $branch" || echo "分支 $branch 已存在"
|
git branch --track "$branch" "$remote" 2>/dev/null && echo "创建本地分支: $branch" || echo "分支 $branch 已存在"
|
||||||
|
|
@ -68,9 +70,9 @@ jobs:
|
||||||
- name: 强制推送所有分支和所有标签到 ${{ matrix.remote.name }}
|
- name: 强制推送所有分支和所有标签到 ${{ matrix.remote.name }}
|
||||||
run: |
|
run: |
|
||||||
echo "将所有分支推送到 ${{ matrix.remote.name }} (修剪模式)..."
|
echo "将所有分支推送到 ${{ matrix.remote.name }} (修剪模式)..."
|
||||||
git push --force --prune ${{ matrix.remote.name }} --all
|
git push --force --prune ${{ matrix.remote.ssh-host }} --all
|
||||||
echo "将所有 tags 推送到 ${{ matrix.remote.name }}..."
|
echo "将所有 tags 推送到 ${{ matrix.remote.name }}..."
|
||||||
git push --force ${{ matrix.remote.name }} --tags
|
git push --force ${{ matrix.remote.ssh-host }} --tags
|
||||||
|
|
||||||
- name: 记录成功摘要
|
- name: 记录成功摘要
|
||||||
if: success()
|
if: success()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue