将 sync-to-gitea.yml 改为调用 ci-config 可复用工作流
自动发布开发环境 Nacos 配置 / publish (push) Successful in 37s

- 原 71 行完整实现迁移到 ci-config 分支

- dev 分支只保留 13 行调用入口
This commit is contained in:
2026-11-23 16:51:06 +08:00
parent 0a0fbbc916
commit db58885ecf
+5 -56
View File
@@ -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 }}