diff --git a/hooks/post-push b/hooks/post-push deleted file mode 100644 index eb7149a..0000000 --- a/hooks/post-push +++ /dev/null @@ -1,5 +0,0 @@ -#!/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/hooks/post-push.cmd b/hooks/post-push.cmd new file mode 100644 index 0000000..91068e7 --- /dev/null +++ b/hooks/post-push.cmd @@ -0,0 +1,6 @@ +@echo off +setlocal +set "REPO_ROOT=%~dp0..\.." +powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%REPO_ROOT%\deploy-cloudflare.ps1" +if errorlevel 1 exit /b 1 +exit /b 0 diff --git a/install-cloudflare-hook.ps1 b/install-cloudflare-hook.ps1 index 7a5d403..3e76091 100644 --- a/install-cloudflare-hook.ps1 +++ b/install-cloudflare-hook.ps1 @@ -1,13 +1,14 @@ $ErrorActionPreference = "Stop" $root = Split-Path -Parent $MyInvocation.MyCommand.Path $hooks = Join-Path $root ".git\hooks" -$source = Join-Path $root "hooks\post-push" -$target = Join-Path $hooks "post-push" +$source = Join-Path $root "hooks\post-push.cmd" +$target = Join-Path $hooks "post-push.cmd" 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 Write-Host "Zainstalowano hook post-push: $target" Write-Host "Po kazdym udanym git push zostanie uruchomiony deploy do Cloudflare Pages."