-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathpublish.ps1
More file actions
34 lines (32 loc) · 1.39 KB
/
publish.ps1
File metadata and controls
34 lines (32 loc) · 1.39 KB
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
<#
generated with CMTools 0.0.10 b59480b
.SYNOPSIS
Publish script for GitHub pages. It expects the gh-pages branch to already exist.
#>
$workingBranch = git branch | Select-String -Pattern "\* " | ForEach-Object { $_ -replace '\* ', '' }
if ($workingBranch -eq "gh-pages") {
git commit -am "publishing to gh-pages branch"
git push origin gh-pages
} else {
Write-Output "You're in $workingBranch branch"
Write-Output "You need to pull in changes to the gh-pages branch to publish"
$yesNo = Read-Host "Process Y/n"
if ($yesNo -eq "Y" -or $yesNo -eq "y") {
Write-Output "Committing and pushing to $workingBranch"
git commit -am "committing to $workingBranch"
git push origin $workingBranch
Write-Output "Changing branches from $workingBranch to gh-pages"
git checkout gh-pages
Write-Output "Merging changes from origin gh-pages"
git pull origin gh-pages
git commit -am "merging origin gh-pages"
Write-Output "Pulling changes from $workingBranch into gh-pages"
git pull origin $workingBranch
Write-Output "Merging changes from $workingBranch"
git commit -am "merging $workingBranch with gh-pages"
Write-Output "Pushing changes up and publishing"
git push origin gh-pages
Write-Output "Changing back to your working branch $workingBranch"
git checkout $workingBranch
}
}