forked from timvideos/getting-started
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_generate.sh
67 lines (52 loc) · 1.4 KB
/
_generate.sh
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
#! /bin/bash
set -e
set -x
if [ ! -d /tmp/timvideos-website ]; then
mkdir -p /tmp/timvideos-website
fi
cd /tmp/timvideos-website
# Tell ssh to use the given identity
cat > /tmp/timvideos-website/ssh <<'EOF'
#!/bin/sh
exec ssh -i ~/.ssh/timvideos-website "$@"
EOF
chmod a+x /tmp/timvideos-website/ssh
export GIT_SSH=/tmp/timvideos-website/ssh
# Get the wiki code and generate the website
####################################################################
if [ ! -d wiki ]; then
git clone git@github.com:timvideos/getting-started.wiki.git wiki
cd wiki
git remote add mirror git@github.com:timvideos/getting-started.git
else
cd wiki
fi
# Get the latest data
git pull
# Push the changes to the front page.
git push mirror --all
COMMIT_ID=$(git rev-parse HEAD)
# Run jekyll
jekyll --kramdown > /dev/null 2>&1
cd ..
# Commit the generated website to gh-pages
####################################################################
if [ ! -d website ]; then
git clone git@github.com:timvideos/timvideos.github.io.git website
cd website
else
cd website
git pull -q
fi
# Remove the old content
rm -rf *
# Get back the README.md file
git checkout -q README.md
# Copy the site into this directory
cp -R ../wiki/_site/* .
git status
# Make git match the content
git add -A .
git commit -q -m "Converted /~https://github.com/timvideos/getting-started/commit/$COMMIT_ID"
# Push the change
git push -q