2026-09-18 19:21:23 +02:00
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
|
$root = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
|
|
|
$hooks = Join-Path $root ".git\hooks"
|
2026-09-18 19:36:29 +02:00
|
|
|
$source = Join-Path $root "hooks\post-push"
|
|
|
|
|
$target = Join-Path $hooks "post-push"
|
2026-09-18 19:21:23 +02:00
|
|
|
|
|
|
|
|
if (-not (Test-Path $hooks)) {
|
|
|
|
|
throw "Nie znaleziono folderu .git/hooks. Uruchom skrypt w katalogu repozytorium."
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-18 19:36:59 +02:00
|
|
|
git -C $root config --local core.hooksPath ".git/hooks"
|
2026-09-18 19:21:23 +02:00
|
|
|
Copy-Item $source $target -Force
|
2026-09-18 19:36:29 +02:00
|
|
|
Remove-Item (Join-Path $hooks "post-push.cmd") -Force -ErrorAction SilentlyContinue
|
|
|
|
|
|
|
|
|
|
$bash = "C:\Program Files\Git\bin\bash.exe"
|
|
|
|
|
if (Test-Path $bash) {
|
|
|
|
|
& $bash -lc "chmod +x '$($target -replace '\\','/')'"
|
|
|
|
|
}
|
2026-09-18 19:21:23 +02:00
|
|
|
Write-Host "Zainstalowano hook post-push: $target"
|
|
|
|
|
Write-Host "Po kazdym udanym git push zostanie uruchomiony deploy do Cloudflare Pages."
|