Рефакторинг: оптимизация скрипта синхронизации вики в Makefile.
This commit is contained in:
@@ -521,28 +521,7 @@ release-local: checksum
|
||||
ifeq ($(OS),Windows_NT)
|
||||
wiki-update:
|
||||
$(info >>> Синхронизация wiki в Gitea...)
|
||||
if (-Not (Test-Path 'wiki')) { throw 'Папка wiki/ не найдена.' }
|
||||
$$origin = git remote get-url origin
|
||||
if (-not $$origin) { throw 'Не найден remote origin.' }
|
||||
if ($$origin -match '\.git$$') { $$wikiUrl = $$origin -replace '\.git$$', '.wiki.git' } else { $$wikiUrl = "$$origin.wiki.git" }
|
||||
$$tmp = '$(BUILD_DIR)\\.wiki-sync'
|
||||
Remove-Item -Recurse -Force $$tmp -ErrorAction SilentlyContinue
|
||||
New-Item -ItemType Directory -Force '$(BUILD_DIR)' | Out-Null
|
||||
git clone --depth 1 $$wikiUrl $$tmp
|
||||
robocopy wiki $$tmp /MIR /XD .git | Out-Null; if ($$LASTEXITCODE -gt 7) { throw 'Ошибка robocopy при синхронизации wiki.' }
|
||||
Push-Location $$tmp
|
||||
git add -A
|
||||
if (git diff --cached --quiet) {
|
||||
$(info >>> Изменений в wiki нет.)
|
||||
Pop-Location
|
||||
} else {
|
||||
git config user.name "wiki-sync-bot"
|
||||
git config user.email "wiki-sync@local"
|
||||
git commit -m "docs(wiki): sync from main repo"
|
||||
git push origin HEAD
|
||||
Pop-Location
|
||||
$(info >>> Wiki успешно обновлена.)
|
||||
}
|
||||
@$$ErrorActionPreference = "Stop"; if (-Not (Test-Path "wiki")) { throw "wiki/ folder not found." }; $$origin = git remote get-url origin; if (-not $$origin) { throw "origin remote not found." }; if ($$origin -match "\.git$$") { $$wikiUrl = $$origin -replace "\.git$$", ".wiki.git" } else { $$wikiUrl = "$$origin.wiki.git" }; $$tmp = "$(BUILD_DIR)\\.wiki-sync"; Remove-Item -Recurse -Force $$tmp -ErrorAction SilentlyContinue; New-Item -ItemType Directory -Force "$(BUILD_DIR)" | Out-Null; git clone --depth 1 $$wikiUrl $$tmp; robocopy wiki $$tmp /MIR /XD .git | Out-Null; if ($$LASTEXITCODE -gt 7) { throw "robocopy failed while syncing wiki." }; Push-Location $$tmp; git add -A; git diff --cached --quiet; if ($$LASTEXITCODE -eq 0) { Write-Host "No wiki changes."; Pop-Location; exit 0 }; git config user.name "wiki-sync-bot"; git config user.email "wiki-sync@local"; git commit -m "docs(wiki): sync from main repo"; git push origin HEAD; Pop-Location; Write-Host "Wiki synced successfully."
|
||||
else
|
||||
wiki-update:
|
||||
$(info >>> Синхронизация wiki в Gitea...)
|
||||
|
||||
Submodule
+1
Submodule build/.wiki-sync added at 556b793e26
Reference in New Issue
Block a user