Files
filtry_www/install-cloudflare-hook.ps1
T

22 lines
845 B
PowerShell
Raw Normal View History

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:37:55 +02:00
$source = Join-Path $root "hooks\pre-push"
$target = Join-Path $hooks "pre-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:37:20 +02:00
git -C $root config --local core.hooksPath "$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
2026-09-18 19:37:55 +02:00
Remove-Item (Join-Path $hooks "post-push") -Force -ErrorAction SilentlyContinue
2026-09-18 19:36:29 +02:00
$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."