diff --git a/hooks/post-push b/hooks/post-push new file mode 100644 index 0000000..eb7149a --- /dev/null +++ b/hooks/post-push @@ -0,0 +1,5 @@ +#!/bin/sh +set -e + +repo_root=$(git rev-parse --show-toplevel) +powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$repo_root/deploy-cloudflare.ps1" diff --git a/install-cloudflare-hook.ps1 b/install-cloudflare-hook.ps1 index 3e76091..d2056f2 100644 --- a/install-cloudflare-hook.ps1 +++ b/install-cloudflare-hook.ps1 @@ -1,14 +1,19 @@ $ErrorActionPreference = "Stop" $root = Split-Path -Parent $MyInvocation.MyCommand.Path $hooks = Join-Path $root ".git\hooks" -$source = Join-Path $root "hooks\post-push.cmd" -$target = Join-Path $hooks "post-push.cmd" +$source = Join-Path $root "hooks\post-push" +$target = Join-Path $hooks "post-push" if (-not (Test-Path $hooks)) { throw "Nie znaleziono folderu .git/hooks. Uruchom skrypt w katalogu repozytorium." } Copy-Item $source $target -Force -Remove-Item (Join-Path $hooks "post-push") -Force -ErrorAction SilentlyContinue +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 '\\','/')'" +} Write-Host "Zainstalowano hook post-push: $target" Write-Host "Po kazdym udanym git push zostanie uruchomiony deploy do Cloudflare Pages."