From 2b4676ae347e736c625d5d349caf58cea73047dd Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Wed, 30 Sep 2026 00:04:16 +0800 Subject: [PATCH] =?UTF-8?q?ci(=E9=83=A8=E7=BD=B2):=20=E6=8E=A8=20origin=20?= =?UTF-8?q?=E6=97=B6=20Gitea=20=E4=B9=9F=E4=BC=9A=E6=8B=BF=E8=BF=99?= =?UTF-8?q?=E4=BB=BD=E5=B7=A5=E4=BD=9C=E6=B5=81=E5=86=8D=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E4=B8=80=E9=81=8D=EF=BC=8C=E6=94=B9=E6=88=90=E5=8F=AA=E5=9C=A8?= =?UTF-8?q?=20GitHub=20=E4=B8=8A=E8=B7=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- .github/workflows/deploy.yml | 8 ++++++-- docs/deploy.md | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 53628dd..e37f262 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -7,11 +7,14 @@ # 服务器自己编的能力**没有砍掉**:docker/deploy.sh 不带 --prebuilt 就是原来的 # 行为(ARTIFACTS=build),只要机器上有 docker 就能手动部署,不依赖这个工作流。 # -# 触发的是 push 到 **github** 这个 remote(origin 是 git.xuyue.cc,平时那次 -# push 不会触发): +# 触发的是 push 到 **github** 这个 remote: # # git push github main # +# origin(git.xuyue.cc)是 Gitea,仓库里没有 .gitea/workflows 时它的 Actions 会退回来 +# 读这份 .github/workflows,每次 push origin 都会把部署再跑一遍 —— 那边不需要。 +# 所以下面 job 上卡了 server_url:只在 GitHub 上跑,Gitea 上直接跳过。 +# # 仓库 Settings → Secrets 需要两个: # HOST 服务器地址 # KEY 能以 root 登录该服务器的私钥(完整 PEM,含首尾 BEGIN/END 行) @@ -45,6 +48,7 @@ env: jobs: deploy: + if: github.server_url == 'https://github.com' runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 diff --git a/docs/deploy.md b/docs/deploy.md index fa571d6..ae650a9 100644 --- a/docs/deploy.md +++ b/docs/deploy.md @@ -64,7 +64,9 @@ cd OJ2 && docker/deploy.sh # 马上重新部署,api / worker 带 `.github/workflows/deploy.yml` —— 在 runner 上编好产物、rsync 到服务器、在服务器上 跑 `docker/deploy.sh --prebuilt`。触发的是 push 到 **github** 这个 remote -(`origin` 是 `git.xuyue.cc`,平时那次 push 不触发): +(`origin` 是 `git.xuyue.cc`,平时那次 push 不触发 —— 那边是 Gitea,没有 +`.gitea/workflows` 时它的 Actions 会退回来读这份工作流,所以 job 上卡了 +`github.server_url == 'https://github.com'`,在 Gitea 上直接跳过): ```bash git push github main