更改项目cd地址
Some checks are pending
Update Code / CD (windows-101.36.102.136) (push) Blocked by required conditions
Update Code / CD (windows-101.36.104.175) (push) Blocked by required conditions
Update Code / StopService (windows-101.36.104.175) (push) Successful in 1s
Update Code / StopService (windows-101.36.102.136) (push) Successful in 0s

This commit is contained in:
work
2026-04-09 11:52:11 +08:00
parent 74a81da54a
commit b6f1b7c8d7

View File

@@ -45,17 +45,24 @@ jobs:
- name: 更新或clone项目
shell: powershell
run: |
if (-not (Test-Path -Path "${{ env.DESTINATION }}\.git")) {
# 目录不存在,执行 git clone
git clone "${{ env.REPOSITORY_URL }}" "${{ env.DESTINATION }}"
}
else {
# 目录存在,更新远程地址并拉取
Set-Location "${{ env.DESTINATION }}"
# 检查并更新远程地址
$dest = "${{ env.DESTINATION }}"
# 检查是否是有效的 Git 仓库
if (Test-Path -Path "$dest\.git") {
# 是有效的 Git 仓库,更新远程地址并拉取
Set-Location $dest
git remote set-url origin "${{ env.REPOSITORY_URL }}"
git pull
}
else {
# 不是有效的 Git 仓库,删除目录(如果存在)然后重新克隆
if (Test-Path -Path $dest) {
Write-Host "Removing existing directory: $dest"
Remove-Item -Path $dest -Recurse -Force
}
# 克隆新仓库
git clone "${{ env.REPOSITORY_URL }}" $dest
}
- name: Set up Python
uses: actions/setup-python@v3
with: