-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_website.sh
70 lines (55 loc) · 1.54 KB
/
update_website.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
68
69
70
URL=${GIT_REPOSITORY}
SRC_URL_WEB=https://github.com/TeraTermProject/web.git
SRC_URL_TT=https://github.com/TeraTermProject/teraterm.git
SRC=web
DIST=github_io
if [ -z "$URL" ]; then
echo GIT_REPOSITORY is empty
exit 1;
fi
echo GIT_USER_NAME=${GIT_USER_NAME}
echo GIT_USER_EMAIL=${GIT_USER_EMAIL}
rm -rf $DIST
git clone $URL $DIST
(cd $DIST ; ls | egrep -v '^$DIST/.git$' | xargs rm -rf)
# /
rm -rf $SRC
git clone --branch main --depth 1 ${SRC_URL_WEB} $SRC
rm -rf $SRC/.git
cp -r $SRC/* $DIST
# manual/5
rm -rf $SRC
git clone --branch main --depth 1 ${SRC_URL_TT} $SRC
mkdir $DIST/manual/5/en
cp -r $SRC/doc/en/html/* $DIST/manual/5/en
mkdir $DIST/manual/5/ja
cp -r $SRC/doc/ja/html/* $DIST/manual/5/ja
# manual/4-stable
rm -rf $SRC
git clone --branch 4-stable --depth 1 ${SRC_URL_TT} $SRC
mkdir $DIST/manual/4/en
cp -r $SRC/doc/en/html/* $DIST/manual/4/en
mkdir $DIST/manual/4/ja
cp -r $SRC/doc/ja/html/* $DIST/manual/4/ja
# convert UTF-8 html
find $DIST/manual -name "*.html" -exec perl convert_utf8html.pl {} \;
# additional files
rm $DIST/manual/5/en/reference/.gitignore
rm $DIST/manual/5/ja/reference/.gitignore
(cd add; cp -r . ../$DIST/)
# push $DIST
pushd $DIST
git config --local user.name ${GIT_USER_NAME}
git config --local user.email ${GIT_USER_EMAIL}
# remove deleted files from repository
del_file_count=`git ls-files --deleted | wc -l`
if [ $del_file_count -ne 0 ]; then
echo git rm `git ls-files --deleted`
git ls-files --deleted -z | xargs -0 git rm
fi
# add new file to repository
git add .
git commit -m "update"
git push
popd
rm -rf $SRC