From 1acd776d3bf05fd2d366cef295af835d9d883419 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 8 Oct 2025 19:17:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=90=AF=E5=8A=A8=E6=8E=92=E9=98=9F?= =?UTF-8?q?=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy-docs.yml | 7 ++++++- .github/workflows/deploy-staging.yml | 11 ++++++++--- .github/workflows/deploy.yml | 9 +++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 2f1dac164..a60f63b00 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -11,12 +11,17 @@ on: permissions: contents: write +# 文档发布自己的排队锁,不影响服务器部署 +concurrency: + group: openisle-docs + cancel-in-progress: false + jobs: build-docs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 1 diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index 6f03af5ab..e4d92a7f8 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -2,22 +2,27 @@ name: Staging CI & CD on: push: - branches: [main] + branches: [ "main" ] workflow_dispatch: permissions: contents: write +# 与生产部署共用同一把锁,确保服务器上始终串行(跨工作流也互斥) +concurrency: + group: openisle-server + cancel-in-progress: false + jobs: build-and-deploy: runs-on: ubuntu-latest environment: Deploy - if: ${{ !github.event.repository.fork }} # 只有非 fork 才执行 + if: ${{ !github.event.repository.fork }} steps: - uses: actions/checkout@v4 - - name: Deploy to Server + - name: Deploy to Server (staging) uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SSH_HOST }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b477cd771..dca1c942e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,7 +3,12 @@ name: CI & CD on: workflow_dispatch: schedule: - - cron: "0 19 * * *" # 每天 UTC 19:00,相当于北京时间凌晨3点 + - cron: "0 19 * * *" # 每天 UTC 19:00(北京 03:00) + +# 与 Staging 共用同一把锁,避免两边同时在 8G 服务器上跑 +concurrency: + group: openisle-server + cancel-in-progress: false jobs: build-and-deploy: @@ -13,7 +18,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Deploy to Server + - name: Deploy to Server (prod) uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SSH_HOST }}