forked from ErpNetDocs/dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
41 lines (33 loc) · 958 Bytes
/
build.ps1
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
param(
[string]$docfx,
[string]$remote,
[switch]$debug
)
if ($debug -eq $true) {
#$git_bin = "C:\Program Files\Git\usr\bin"
$working_directory = Get-Location | Out-String
Write-Host "cwd is $working_directory"
Write-Host "user is $env:USERNAME"
if (test-path "$home\.ssh\id_rsa.pub") {
Write-Host "Has public key:"
Get-Content "$home\.ssh\id_rsa.pub"
}
else {
Write-Host "Doesn't have SSH public key!!"
}
}
Write-Host "Setting up git remote ssh..."
git config remote.ssh.url
if ($lastexitcode -eq 1) {
git remote add ssh $remote
}
Write-Host "Getting Latest Changes"
git checkout master
git pull --rebase
Write-Host "Building docfx"
Invoke-Expression "$docfx build"
Write-Host "Upload Changes to Github"
git add -A
$now = [System.DateTime]::Now.ToShortTimeString();
git commit -m "Latest changes from buid bot: $now"
git push ssh master