From 92d89da925cb47e1d9c29f083590c2feee1a5a96 Mon Sep 17 00:00:00 2001 From: Andrew Kahr <22359829+AndrewKahr@users.noreply.github.com> Date: Sun, 5 Mar 2023 03:35:09 -0800 Subject: [PATCH] Fix #428 --- dist/platforms/windows/entrypoint.ps1 | 9 ++++++--- dist/platforms/windows/set_gitcredential.ps1 | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 dist/platforms/windows/set_gitcredential.ps1 diff --git a/dist/platforms/windows/entrypoint.ps1 b/dist/platforms/windows/entrypoint.ps1 index b5255d11..f0a6b555 100644 --- a/dist/platforms/windows/entrypoint.ps1 +++ b/dist/platforms/windows/entrypoint.ps1 @@ -1,6 +1,3 @@ -# Activate Unity -& "c:\steps\activate.ps1" - # Import any necessary registry keys, ie: location of windows 10 sdk # No guarantee that there will be any necessary registry keys, ie: tvOS Get-ChildItem -Path c:\regkeys -File | Foreach {reg import $_.fullname} @@ -8,6 +5,12 @@ Get-ChildItem -Path c:\regkeys -File | Foreach {reg import $_.fullname} # Register the Visual Studio installation so Unity can find it regsvr32 C:\ProgramData\Microsoft\VisualStudio\Setup\x64\Microsoft.VisualStudio.Setup.Configuration.Native.dll +# Setup Git Credentials +& "c:\steps\set_gitcredential.ps1" + +# Activate Unity +& "c:\steps\activate.ps1" + # Build the project & "c:\steps\build.ps1" diff --git a/dist/platforms/windows/set_gitcredential.ps1 b/dist/platforms/windows/set_gitcredential.ps1 new file mode 100644 index 00000000..de4d701b --- /dev/null +++ b/dist/platforms/windows/set_gitcredential.ps1 @@ -0,0 +1,20 @@ +if ([string]::IsNullOrEmpty($env:GIT_PRIVATE_TOKEN)) { + Write-Host "GIT_PRIVATE_TOKEN unset skipping" +} +else { + Write-Host "GIT_PRIVATE_TOKEN is set configuring git credentials" + + git config --global credential.helper store + git config --global --replace-all "url.https://token:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "ssh://git@github.com/" + git config --global --add "url.https://token:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "git@github.com" + + git config --global --add "url.https://token:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "https://github.com/" + git config --global "url.https://ssh:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "ssh://git@github.com/" + git config --global "url.https://git:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "git@github.com:" +} + +Write-Host "---------- git config --list -------------" +git config --list + +Write-Host "---------- git config --list --show-origin -------------" +git config --list --show-origin