Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
LJHG committed Dec 28, 2024
1 parent a674abb commit ca3d6aa
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions publish.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# 设置目标仓库的 URL 和分支
REPO_URL="https://github.com/LJHG/ljhg.github.io.git"
BRANCH="main"
BRANCH="master" # 使用 master 作为分支名

# 检查并创建 mysite 文件夹
if [ ! -d "./mysite" ]; then
mkdir mysite
cd ./mysite
git init
git remote add origin $REPO_URL
git fetch origin
git checkout $BRANCH || git checkout -b $BRANCH
cd ..
fi

Expand All @@ -20,14 +18,19 @@ if [ $? -ne 0 ]; then
exit 1
fi

# 提交并推送更改
# 进入 mysite 并提交更改
cd ./mysite

# 切换到 master 分支(如果不存在则创建)
git checkout $BRANCH || git checkout -b $BRANCH

# 提交并推送更改
git add -A
git commit -m "Update site content from GitBook"
git push origin $BRANCH
git commit -m "Initial commit: Update site content from GitBook"
git push -u origin $BRANCH
if [ $? -ne 0 ]; then
echo "Error: Failed to push changes to $REPO_URL"
exit 1
fi

echo "Site successfully built and pushed to $REPO_URL"
echo "Site successfully built and pushed to $REPO_URL on branch $BRANCH"

0 comments on commit ca3d6aa

Please sign in to comment.