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 }}