-
Notifications
You must be signed in to change notification settings - Fork 61
/
publish.ps1
50 lines (41 loc) · 1.38 KB
/
publish.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
42
43
44
45
46
47
48
49
50
#.SYNOPSIS
# Simple 1-step publish script, but has many assumptions. See description.
#.DESCRIPTION
# This publish is a simple local convenience measure for publishing SnowSite
# from localhost to your gitrepo, assuming you've customized SnowSite to become
# your site.
#
# It also assumes you've already compiled Sandra.snow in "debug" mode.
#
# It also assumes that your "config" is set to output directly into your target
# static site repo.
#
# If any of these assumptions are false, you may need to use a different publish
# script, or customize this one.
param (
# git commit message for both Sandra.Snow repo and output repo.
[Parameter(mandatory)]
[string] $commitMessage,
# path to the config file. Must be in the site directory. Defaults to SnowSite\Snow\Snow.config
[Parameter()]
[IO.FileInfo] $configPath = $null
)
Push-Location $PSScriptRoot
# defaulting.
if (-not $configPath) {
$configPath = [IO.FileInfo](Resolve-Path ".\SnowSite\Snow\Snow.config.json").Path
}
$configDirPath = Split-Path $configPath -Parent
$outputPath = Resolve-Path (Join-Path $configDirPath $config.postsOutput)
& src\Snow\bin\Debug\Snow config=$configPath
#region commits
git add .
git commit -m $message
git push
Push-Location $outputPath
git add .
git commit -m $message
git push
Pop-Location
#endregion commits
Pop-Location