更改项目cd地址
All checks were successful
Update Code / StopService (windows-101.36.102.136) (push) Successful in 0s
Update Code / StopService (windows-101.36.104.175) (push) Successful in 1s
Update Code / CD (windows-101.36.102.136) (push) Successful in 8s
Update Code / CD (windows-101.36.104.175) (push) Successful in 12s
All checks were successful
Update Code / StopService (windows-101.36.102.136) (push) Successful in 0s
Update Code / StopService (windows-101.36.104.175) (push) Successful in 1s
Update Code / CD (windows-101.36.102.136) (push) Successful in 8s
Update Code / CD (windows-101.36.104.175) (push) Successful in 12s
This commit is contained in:
@@ -5,7 +5,7 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
env:
|
env:
|
||||||
DESTINATION: C:\Facebook
|
DESTINATION: C:\Facebook2
|
||||||
REPOSITORY_URL: http://deploy:123qwe123@123.58.209.87:3000/he/py_facebook.git
|
REPOSITORY_URL: http://deploy:123qwe123@123.58.209.87:3000/he/py_facebook.git
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -45,23 +45,14 @@ jobs:
|
|||||||
- name: 更新或clone项目
|
- name: 更新或clone项目
|
||||||
shell: powershell
|
shell: powershell
|
||||||
run: |
|
run: |
|
||||||
$dest = "${{ env.DESTINATION }}"
|
if (-not (Test-Path -Path $env:DESTINATION\.git)) {
|
||||||
|
# 目录不存在,执行 git clone
|
||||||
# 检查是否是有效的 Git 仓库
|
git clone $env:REPOSITORY_URL $env:DESTINATION
|
||||||
if (Test-Path -Path "$dest\.git") {
|
|
||||||
# 是有效的 Git 仓库,更新远程地址并拉取
|
|
||||||
Set-Location $dest
|
|
||||||
git remote set-url origin "${{ env.REPOSITORY_URL }}"
|
|
||||||
git pull
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# 不是有效的 Git 仓库,删除目录(如果存在)然后重新克隆
|
# 目录存在,执行 git pull
|
||||||
if (Test-Path -Path $dest) {
|
Set-Location $env:DESTINATION
|
||||||
Write-Host "Removing existing directory: $dest"
|
git pull
|
||||||
Remove-Item -Path $dest -Recurse -Force
|
|
||||||
}
|
|
||||||
# 克隆新仓库
|
|
||||||
git clone "${{ env.REPOSITORY_URL }}" $dest
|
|
||||||
}
|
}
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v3
|
uses: actions/setup-python@v3
|
||||||
@@ -69,7 +60,7 @@ jobs:
|
|||||||
python-version: "3.10"
|
python-version: "3.10"
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
Set-Location ${{ env.DESTINATION }}
|
Set-Location $env:DESTINATION
|
||||||
"${{ matrix.machine }}" | Set-Content -Path "ip.txt" -Encoding UTF8
|
"${{ matrix.machine }}" | Set-Content -Path "ip.txt" -Encoding UTF8
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
@@ -81,5 +72,5 @@ jobs:
|
|||||||
- name: Start FastAPI server
|
- name: Start FastAPI server
|
||||||
timeout-minutes: 3 # 设定超时时间为 3 分钟
|
timeout-minutes: 3 # 设定超时时间为 3 分钟
|
||||||
run: |
|
run: |
|
||||||
Set-Location ${{ env.DESTINATION }}
|
Set-Location $env:DESTINATION
|
||||||
Start-Process -WindowStyle hidden -FilePath python .\main.py
|
Start-Process -WindowStyle hidden -FilePath python .\main.py
|
||||||
|
|||||||
Reference in New Issue
Block a user