Рефакторинг: оптимизация скрипта синхронизации вики в Makefile.

This commit is contained in:
Dmitriy Fofanov
2026-02-23 14:29:24 +03:00
parent 62bc781e19
commit 5d1b2362d2
2 changed files with 2 additions and 22 deletions
+1 -22
View File
@@ -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...)
+1
Submodule build/.wiki-sync added at 556b793e26