fix: 修复版本tag异常的工作流

This commit is contained in:
Blank 2025-05-31 10:03:02 +08:00
parent 8fc77f90af
commit 69f8a82582
1 changed files with 41 additions and 31 deletions

View File

@ -1,12 +1,17 @@
name: Sync Github To Image
on:
workflow_run:
workflows: ["Publish Release"] # 监听的工作流名称
types:
- completed # 监听完成事件
push:
branches: [main]
#schedule:
# 定时任务,每天 UTC 时间 0 点运行
#- cron: "0 0 * * *"
#workflow_dispatch:
workflow_dispatch:
jobs:
sync-gitlink:
@ -42,21 +47,22 @@ jobs:
# 添加远端
- name: add remote url
run: git remote add gitlink "git@code.gitlink.org.cn:${{ github.Repository }}.git"
run: git remote add mirror "git@code.gitlink.org.cn:${{ github.Repository }}.git"
# 获取
- name: fetch
run: git fetch --prune gitlink --tags --verbose
run: git fetch --prune mirror --tags --verbose
# 拉取
# 拉取和推送
- name: pull and push
run: |
if [ "${{ github.ref_name }}" ]; then
git checkout ${{ github.ref_name }}
git pull --progress -v --no-rebase gitlink ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
git push -u gitlink ${{ github.ref_name }} --tags --verbose
git push -f mirror ${{ github.ref_name }}
git push -f mirror --tags --verbose
fi
sync-gitlab:
runs-on: ubuntu-latest
@ -88,21 +94,22 @@ jobs:
# 添加远端
- name: add remote url
run: git remote add gitlab "git@gitlab.com:${{ github.Repository }}.git"
run: git remote add mirror "git@gitlab.com:${{ github.Repository }}.git"
# 获取
- name: fetch
run: git fetch --prune gitlab --tags --verbose
run: git fetch --prune mirror --tags --verbose
# 拉取
# 拉取和推送
- name: pull and push
run: |
if [ "${{ github.ref_name }}" ]; then
git checkout ${{ github.ref_name }}
git pull --progress -v --no-rebase gitlab ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
git push -u gitlab ${{ github.ref_name }} --tags --verbose
git push -f mirror ${{ github.ref_name }}
git push -f mirror --tags --verbose
fi
sync-gitee:
runs-on: ubuntu-latest
@ -134,21 +141,22 @@ jobs:
# 添加远端
- name: add remote url
run: git remote add gitee "git@gitee.com:${{ github.Repository }}.git"
run: git remote add mirror "git@gitee.com:${{ github.Repository }}.git"
# 获取
- name: fetch
run: git fetch --prune gitee --tags --verbose
run: git fetch --prune mirror --tags --verbose
# 拉取
# 拉取和推送
- name: pull and push
run: |
if [ "${{ github.ref_name }}" ]; then
git checkout ${{ github.ref_name }}
git pull --progress -v --no-rebase gitee ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
git push -u gitee ${{ github.ref_name }} --tags --verbose
git push -f mirror ${{ github.ref_name }}
git push -f mirror --tags --verbose
fi
sync-atomgit:
runs-on: ubuntu-latest
@ -180,21 +188,22 @@ jobs:
# 添加远端
- name: add remote url
run: git remote add atomgit "git@atomgit.com:${{ github.Repository }}.git"
run: git remote add mirror "git@atomgit.com:${{ github.Repository }}.git"
# 获取
- name: fetch
run: git fetch --prune atomgit --tags --verbose
run: git fetch --prune mirror --tags --verbose
# 拉取
# 拉取和推送
- name: pull and push
run: |
if [ "${{ github.ref_name }}" ]; then
git checkout ${{ github.ref_name }}
git pull --progress -v --no-rebase atomgit ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
git push -u atomgit ${{ github.ref_name }} --tags --verbose
git push -f mirror ${{ github.ref_name }}
git push -f mirror --tags --verbose
fi
sync-gitcode:
runs-on: ubuntu-latest
@ -226,20 +235,21 @@ jobs:
# 添加远端
- name: add remote url
run: git remote add gitcode "git@gitcode.net:${{ github.Repository }}.git"
run: git remote add mirror "git@gitcode.net:${{ github.Repository }}.git"
# 获取
- name: fetch
run: git fetch --prune gitcode --tags --verbose
run: git fetch --prune mirror --tags --verbose
# 拉取
# 拉取和推送
- name: pull and push
run: |
if [ "${{ github.ref_name }}" ]; then
git checkout ${{ github.ref_name }}
git pull --progress -v --no-rebase gitcode ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
git push -u gitcode ${{ github.ref_name }} --tags --verbose
git push -f mirror ${{ github.ref_name }}
git push -f mirror --tags --verbose
fi
sync-framagit:
runs-on: ubuntu-latest
@ -272,17 +282,17 @@ jobs:
# 添加远端
- name: add remote url
run: git remote add framagit "git@framagit.org:${{ github.Repository }}.git"
run: git remote add mirror "git@framagit.org:${{ github.Repository }}.git"
# 获取
- name: fetch
run: git fetch --prune framagit --tags --verbose
run: git fetch --prune mirror --tags --verbose
# 拉取
# 拉取和推送
- name: pull and push
run: |
if [ "${{ github.ref_name }}" ]; then
git checkout ${{ github.ref_name }}
git pull --progress -v --no-rebase framagit ${{ github.ref_name }} --tags --verbose || echo 远端不存在${{ github.ref_name }}分支;
git push -u framagit ${{ github.ref_name }} --tags --verbose
git push -f mirror ${{ github.ref_name }}
git push -f mirror --tags --verbose
fi