forked from oozcitak/exiflibrary
-
Notifications
You must be signed in to change notification settings - Fork 1
/
update documentation.ps1
31 lines (23 loc) · 932 Bytes
/
update documentation.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
Clear-Host
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$RepoURL = "https://github.com/oozcitak/exiflibrary.git"
$DocsDir = Join-Path -Path $ScriptDir -ChildPath ".\Documentation\_site"
$TempDir = Join-Path -Path $ScriptDir -ChildPath ".\TEMP_DOCS"
# create a temporary directory
Set-Location $DocsDir
if (Test-Path $TempDir) { Remove-Item -Path $TempDir -Recurse -Force; }
New-Item -Path $TempDir -ItemType Directory -Force
# clone the repo with the gh-pages branch
git clone $RepoURL --branch gh-pages $TempDir
# clear repo directory
Set-Location $TempDir
git rm -r *
# Copy documentation into the repo
Copy-Item $DocsDir\* -Destination $TempDir -Recurse -Force
# push the new docs to the remote branch
git add . -A
git commit -m "Update generated documentation"
git push origin gh-pages
# remove temp directory
Set-Location $DocsDir
if (Test-Path $TempDir) { Remove-Item -Path $TempDir -Recurse -Force; }