From 69f8a825828571efd0aef7db7223c966ddcf3e0e Mon Sep 17 00:00:00 2001 From: Blank Date: Sat, 31 May 2025 10:03:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=89=88=E6=9C=ACtag?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E7=9A=84=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sync.yml | 72 ++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index fb1c812..ae4521b 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -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