-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,37 @@ | ||
gitbook build . ../tmp_mysite | ||
if [ $? -ne 0 ]; then | ||
echo "Error: GitBook build failed!" | ||
exit 1 | ||
fi | ||
|
||
function publish_to() | ||
{ | ||
repo_name=$1 | ||
cd ../${repo_name} | ||
rm -rf `ls |grep -v .git` | ||
cp -r ../tmp_mysite/* ../${repo_name} | ||
cd ../${repo_name} | ||
target_dir="../${repo_name}" | ||
|
||
echo "Target directory: $target_dir" | ||
if [ ! -d "$target_dir" ]; then | ||
echo "Error: Target directory $target_dir does not exist!" | ||
exit 1 | ||
fi | ||
|
||
cd "$target_dir" || exit | ||
|
||
if [ ! -d ".git" ]; then | ||
echo "Error: $target_dir is not a Git repository!" | ||
exit 1 | ||
fi | ||
|
||
echo "Current working directory: $(pwd)" | ||
|
||
rm -rf `ls | grep -v .git` | ||
cp -r ../tmp_mysite/* "$target_dir" | ||
|
||
git add -A | ||
git commit -a -m 'update from gitbook' | ||
git commit -m 'update from gitbook' | ||
git push | ||
} | ||
|
||
publish_to mysite | ||
|
||
rm -rf ../tmp_mysite | ||
rm -rf ../tmp_mysite |