feat(部署): 添加mdbook自动构建和部署功能

- 新增GitHub Actions工作流实现自动构建和部署
- 修改Docker配置支持mdbook服务并暴露4399端口
- 更新部署文档,提供两种部署方案说明
- 调整构建脚本,优化日报站点生成流程
This commit is contained in:
justlovemaki
2025-06-12 21:53:56 +08:00
parent 826ca56b17
commit f4dc358454
9 changed files with 219 additions and 21 deletions

View File

@@ -38,7 +38,7 @@ rm -rf "$REPO_NAME"
# 4. Fetch: Clone the latest content from GitHub.
echo "--> Cloning repository from $REPO_URL..."
git clone "$REPO_URL"
git clone -b book "$REPO_URL"
# Define the path to the cloned repository for easier access.
PROJECT_DIR="$WORK_DIR/$REPO_NAME"
@@ -58,21 +58,21 @@ rm -rf "$PROJECT_DIR/podcast"
echo "--> Running custom scripts..."
./replace.sh "$PROJECT_DIR/daily"
./gen.sh "$PROJECT_DIR/daily"
mdbook build "$WORK_DIR"
# mdbook build "$WORK_DIR"
# 6. Package & Upload
echo "--> Waiting for generation to complete..."
# This pause assumes the generation script might have background tasks.
# A more robust solution would be to wait for a specific file or process.
sleep 10
# sleep 10
echo "--> Packaging the 'book' directory..."
# Create a gzipped tar archive of the 'book' directory's contents.
tar -cvf archive.tar.gz book/*
# tar -cvf archive.tar.gz book/*
echo "--> Uploading the archive..."
# Upload the archive using a custom script.
# Note: Ensure github.sh is in the $WORK_DIR or in your PATH.
./github.sh upload "archive.tar.gz" "today/archive.tar.gz" "pushbook"
# ./github.sh upload "archive.tar.gz" "today/archive.tar.gz" "pushbook"
echo "--- Workflow completed successfully! ---"