From 0a0fbbc91658b85064fcf07e3bc7fd03c31309b4 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Mon, 23 Nov 2026 16:29:52 +0800 Subject: [PATCH 1/3] =?UTF-8?q?github=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sync-to-gitea.yml | 71 +++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/sync-to-gitea.yml diff --git a/.github/workflows/sync-to-gitea.yml b/.github/workflows/sync-to-gitea.yml new file mode 100644 index 00000000..4366471a --- /dev/null +++ b/.github/workflows/sync-to-gitea.yml @@ -0,0 +1,71 @@ + +name: Sync GitHub dev to Gitea + +on: + push: + branches: + - dev + paths-ignore: + - ".github/workflows/sync-to-gitea.yml" + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: github-to-gitea-dev + cancel-in-progress: false + +jobs: + sync: + name: Push GitHub dev to Gitea dev + runs-on: ubuntu-latest + + steps: + - name: Checkout full history + uses: actions/checkout@v4 + with: + ref: dev + fetch-depth: 0 + + - name: Validate and push to Gitea + shell: bash + env: + GITEA_USERNAME: ${{ secrets.GITEA_USERNAME }} + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + GITHUB_SHA: ${{ github.sha }} + run: | + set -euo pipefail + + if [[ -z "$GITEA_USERNAME" || -z "$GITEA_TOKEN" ]]; then + echo "::error::Missing Gitea credentials." + exit 1 + fi + + AUTH="$(printf '%s' "$GITEA_USERNAME:$GITEA_TOKEN" | base64 -w 0)" + + git remote add gitea https://code.yunail.art/xiaowang/JayuCloud.git + + git -c http.extraheader="AUTHORIZATION: basic $AUTH" \ + fetch gitea refs/heads/dev:refs/remotes/gitea/dev + + GITEA_SHA="$(git rev-parse refs/remotes/gitea/dev)" + + echo "GitHub commit: $GITHUB_SHA" + echo "Gitea commit: $GITEA_SHA" + + if [[ "$GITEA_SHA" == "$GITHUB_SHA" ]]; then + echo "Both repositories are already synchronized." + exit 0 + fi + + if ! git merge-base --is-ancestor "$GITEA_SHA" "$GITHUB_SHA"; then + echo "::error::Gitea dev has diverged from or advanced beyond GitHub dev." + echo "::error::Refusing to overwrite Gitea." + exit 1 + fi + + git -c http.extraheader="AUTHORIZATION: basic $AUTH" \ + push gitea "$GITHUB_SHA:refs/heads/dev" + + echo "Successfully synchronized GitHub dev to Gitea dev." -- 2.54.0 From db58885ecfbe916ffb8feaa2f79473b1eb598830 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Mon, 23 Nov 2026 16:51:06 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=B0=86=20sync-to-gitea.yml=20=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E8=B0=83=E7=94=A8=20ci-config=20=E5=8F=AF=E5=A4=8D?= =?UTF-8?q?=E7=94=A8=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 原 71 行完整实现迁移到 ci-config 分支 - dev 分支只保留 13 行调用入口 --- .github/workflows/sync-to-gitea.yml | 61 +++-------------------------- 1 file changed, 5 insertions(+), 56 deletions(-) diff --git a/.github/workflows/sync-to-gitea.yml b/.github/workflows/sync-to-gitea.yml index 4366471a..92be7802 100644 --- a/.github/workflows/sync-to-gitea.yml +++ b/.github/workflows/sync-to-gitea.yml @@ -1,4 +1,3 @@ - name: Sync GitHub dev to Gitea on: @@ -7,65 +6,15 @@ on: - dev paths-ignore: - ".github/workflows/sync-to-gitea.yml" + workflow_dispatch: permissions: contents: read -concurrency: - group: github-to-gitea-dev - cancel-in-progress: false - jobs: sync: - name: Push GitHub dev to Gitea dev - runs-on: ubuntu-latest - - steps: - - name: Checkout full history - uses: actions/checkout@v4 - with: - ref: dev - fetch-depth: 0 - - - name: Validate and push to Gitea - shell: bash - env: - GITEA_USERNAME: ${{ secrets.GITEA_USERNAME }} - GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} - GITHUB_SHA: ${{ github.sha }} - run: | - set -euo pipefail - - if [[ -z "$GITEA_USERNAME" || -z "$GITEA_TOKEN" ]]; then - echo "::error::Missing Gitea credentials." - exit 1 - fi - - AUTH="$(printf '%s' "$GITEA_USERNAME:$GITEA_TOKEN" | base64 -w 0)" - - git remote add gitea https://code.yunail.art/xiaowang/JayuCloud.git - - git -c http.extraheader="AUTHORIZATION: basic $AUTH" \ - fetch gitea refs/heads/dev:refs/remotes/gitea/dev - - GITEA_SHA="$(git rev-parse refs/remotes/gitea/dev)" - - echo "GitHub commit: $GITHUB_SHA" - echo "Gitea commit: $GITEA_SHA" - - if [[ "$GITEA_SHA" == "$GITHUB_SHA" ]]; then - echo "Both repositories are already synchronized." - exit 0 - fi - - if ! git merge-base --is-ancestor "$GITEA_SHA" "$GITHUB_SHA"; then - echo "::error::Gitea dev has diverged from or advanced beyond GitHub dev." - echo "::error::Refusing to overwrite Gitea." - exit 1 - fi - - git -c http.extraheader="AUTHORIZATION: basic $AUTH" \ - push gitea "$GITHUB_SHA:refs/heads/dev" - - echo "Successfully synchronized GitHub dev to Gitea dev." + uses: xiaowang2219/jayucloud/.github/workflows/reusable-sync-dev-to-gitea.yml@ci-config + secrets: + GITEA_USERNAME: ${{ secrets.GITEA_USERNAME }} + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} -- 2.54.0 From a5629f61195e214edf04bab26af8318fad0f06d2 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Mon, 23 Nov 2026 17:09:54 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=9B=9E=E9=80=80=E6=96=B9=E6=A1=88C?= =?UTF-8?q?=EF=BC=9Async-to-gitea.yml=20=E6=81=A2=E5=A4=8D=E4=B8=BA?= =?UTF-8?q?=E5=AE=8C=E6=95=B4=E8=87=AA=E5=8C=85=E5=90=AB=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 不再依赖 ci-config 分支的可复用工作流 - 撤销对 ci-config 的调用入口,恢复原有 71 行实现 --- .github/workflows/sync-to-gitea.yml | 61 ++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sync-to-gitea.yml b/.github/workflows/sync-to-gitea.yml index 92be7802..4366471a 100644 --- a/.github/workflows/sync-to-gitea.yml +++ b/.github/workflows/sync-to-gitea.yml @@ -1,3 +1,4 @@ + name: Sync GitHub dev to Gitea on: @@ -6,15 +7,65 @@ on: - dev paths-ignore: - ".github/workflows/sync-to-gitea.yml" - workflow_dispatch: permissions: contents: read +concurrency: + group: github-to-gitea-dev + cancel-in-progress: false + jobs: sync: - uses: xiaowang2219/jayucloud/.github/workflows/reusable-sync-dev-to-gitea.yml@ci-config - secrets: - GITEA_USERNAME: ${{ secrets.GITEA_USERNAME }} - GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + name: Push GitHub dev to Gitea dev + runs-on: ubuntu-latest + + steps: + - name: Checkout full history + uses: actions/checkout@v4 + with: + ref: dev + fetch-depth: 0 + + - name: Validate and push to Gitea + shell: bash + env: + GITEA_USERNAME: ${{ secrets.GITEA_USERNAME }} + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + GITHUB_SHA: ${{ github.sha }} + run: | + set -euo pipefail + + if [[ -z "$GITEA_USERNAME" || -z "$GITEA_TOKEN" ]]; then + echo "::error::Missing Gitea credentials." + exit 1 + fi + + AUTH="$(printf '%s' "$GITEA_USERNAME:$GITEA_TOKEN" | base64 -w 0)" + + git remote add gitea https://code.yunail.art/xiaowang/JayuCloud.git + + git -c http.extraheader="AUTHORIZATION: basic $AUTH" \ + fetch gitea refs/heads/dev:refs/remotes/gitea/dev + + GITEA_SHA="$(git rev-parse refs/remotes/gitea/dev)" + + echo "GitHub commit: $GITHUB_SHA" + echo "Gitea commit: $GITEA_SHA" + + if [[ "$GITEA_SHA" == "$GITHUB_SHA" ]]; then + echo "Both repositories are already synchronized." + exit 0 + fi + + if ! git merge-base --is-ancestor "$GITEA_SHA" "$GITHUB_SHA"; then + echo "::error::Gitea dev has diverged from or advanced beyond GitHub dev." + echo "::error::Refusing to overwrite Gitea." + exit 1 + fi + + git -c http.extraheader="AUTHORIZATION: basic $AUTH" \ + push gitea "$GITHUB_SHA:refs/heads/dev" + + echo "Successfully synchronized GitHub dev to Gitea dev." -- 2.54.0