diff --git a/windows/clone.ps1 b/windows/clone.ps1 index 6a8185a..c638a1b 100644 --- a/windows/clone.ps1 +++ b/windows/clone.ps1 @@ -21,6 +21,17 @@ password $Env:DRONE_NETRC_PASSWORD "@ > (Join-Path $Env:USERPROFILE '_netrc'); } +# Windows-specific: Persist Git credentials by mounting _netrc from the shared path +# so that subsequent steps in the pipeline can use them for authenticated Git operations. +if ($Env:DRONE_PERSIST_CREDS) { + $sourcePath = Join-Path $Env:USERPROFILE '_netrc'; + $destinationPath = 'C:\addon\shared\_netrc'; + New-Item -ItemType Directory -Path (Split-Path $destinationPath) -Force; + if (Test-Path -Path $sourcePath) { + Copy-Item -Path $sourcePath -Destination $destinationPath -Force; + } +} + if ($Env:DRONE_SSH_KEY) { mkdir C:\.ssh -Force echo $Env:DRONE_SSH_KEY > C:\.ssh\id_rsa