diff --git a/.gitea/workflows/cd.yaml b/.gitea/workflows/cd.yaml index abe0450..b0c89bb 100644 --- a/.gitea/workflows/cd.yaml +++ b/.gitea/workflows/cd.yaml @@ -7,14 +7,30 @@ on: env: DESTINATION: C:\Facebook REPOSITORY_URL: http://deploy:123qwe123@123.58.209.87:3000/py_facebook/py_facebook.git + MACHINES: | + [ + "windows-101.36.102.136", + "windows-101.36.104.175" + ] + jobs: StopService: - - name: Stop previous service - run: | - try { - Stop-Process -Name "python" -Force -ErrorAction SilentlyContinue - } catch {} + needs: StopService + runs-on: ${{ matrix.machine }} + defaults: + run: + shell: powershell + strategy: + matrix: + machine: ${{ fromJson(env.MACHINES) }} # 使用公共的 machines 列表 + steps: + - name: Stop previous service + run: | + try { + Stop-Process -Name "python" -Force -ErrorAction SilentlyContinue + } catch {} + CD: needs: StopService runs-on: ${{ matrix.machine }} @@ -23,9 +39,7 @@ jobs: shell: powershell strategy: matrix: - machine: - - windows-101.36.102.136 - - windows-101.36.104.175 + machine: ${{ fromJson(env.MACHINES) }} # 使用公共的 machines 列表 steps: - name: 更新或clone项目 shell: powershell