-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathDeployToGhPages.ps1
More file actions
26 lines (24 loc) · 953 Bytes
/
DeployToGhPages.ps1
File metadata and controls
26 lines (24 loc) · 953 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
param (
[Parameter(mandatory=$true)][string]$githubaccesstoken,
[Parameter(mandatory=$true)][string]$artifactDir
)
$ErrorActionPreference = "Stop"
function ExecSafe([scriptblock] $cmd) {
& $cmd
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}
$githubusername = "CoderNate"
cd $artifactDir
if (Test-Path tempDir) {
throw "TempDIr already exists"
}
Write-Host "About to clone into $(Join-Path (Resolve-Path .).Path -ChildPath tempDir)"
# Have to clone into a new directory or git will error saying the directory already exists and is not empty
ExecSafe {git clone --no-checkout --branch=gh-pages "https://$($githubusername):$githubaccesstoken@github.com/$githubusername/CSharpToPython.git" tempDir --quiet}
Move-Item tempDir\.git .git -force
git config core.autocrlf false
git config user.email ncdahlquist@yahoo.com
git config user.name $githubusername
git add -A
git commit --amend --no-edit
ExecSafe {git push --force-with-lease --quiet}