-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish-docs.ps1
91 lines (67 loc) · 1.37 KB
/
publish-docs.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
$sitepath=pwd
$contentpath="../artejs"
# Point to Ruby 2.
# TODO: Find a way to make this portable.
$env:PATH = "C:\Ruby200-x64\bin;$($env:PATH)"
if ($LASTEXITCODE -ne 0)
{
exit
}
echo "Writing site from $contentpath to $sitepath"
pushd $contentpath
if ($LASTEXITCODE -ne 0)
{
echo "Content directory $contentpath could not be found: exiting."
exit
}
#switch the content to the master branch
git checkout master
if ($LASTEXITCODE -ne 0)
{
echo "Could not checkout master branch, probably uncommitted changes: exiting."
exit
}
#generate the dist
grunt build
if ($LASTEXITCODE -ne 0)
{
echo "Grunt build failed for skinny.js: exiting."
exit
}
pushd $sitepath
chcp 65001
# Build the site
grunt
if ($LASTEXITCODE -ne 0)
{
echo "Grunt build failed for skinny site: exiting."
exit
}
# Go back to skinny, where the gh-pages branch is.
# We need to put the site there
pushd $contentpath
git checkout gh-pages
if ($LASTEXITCODE -ne 0)
{
echo "Could not checkout gh-pages branch, probably uncommitted changes: exiting."
exit
}
# Clear the directory of anything that could cause a conflict
git fetch origin
git reset --hard origin/gh-pages
cp $sitepath/site/_site/* . -recurse -force
git add -A
git commit -m "Updating documentation"
if ($LASTEXITCODE -ne 0)
{
exit
}
git push
if ($LASTEXITCODE -ne 0)
{
exit
}
git checkout master
popd
popd
popd