From 249392de038af1caeb94cffba6d350d1d12f30fe Mon Sep 17 00:00:00 2001 From: rapaf Date: Fri, 18 Sep 2026 19:36:29 +0200 Subject: [PATCH] Napraw wykonywanie hooka po pushu Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- hooks/post-push | 5 +++++ install-cloudflare-hook.ps1 | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 hooks/post-push 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."