feat(部署): 添加mdbook自动构建和部署功能
- 新增GitHub Actions工作流实现自动构建和部署 - 修改Docker配置支持mdbook服务并暴露4399端口 - 更新部署文档,提供两种部署方案说明 - 调整构建脚本,优化日报站点生成流程
This commit is contained in:
@@ -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! ---"
|
||||
@@ -3,4 +3,7 @@ authors = []
|
||||
language = "zh"
|
||||
src = "CloudFlare-AI-Insight-Daily"
|
||||
title = "By 何夕2077"
|
||||
create-missing = true
|
||||
create-missing = true
|
||||
|
||||
[output.html]
|
||||
git-repository-url = "https://github.com/justlovemaki/CloudFlare-AI-Insight-Daily" # 替换成你的仓库地址
|
||||
@@ -6,7 +6,7 @@
|
||||
GITHUB_TOKEN=${GITHUB_TOKEN} # 替换 YOUR_GITHUB_PAT 或设置环境变量
|
||||
OWNER=${OWNER} # 你的 GitHub 用户名或组织名
|
||||
REPO=${REPO_NAME} # 你的仓库名称
|
||||
BRANCH="main" # 目标分支 (可能是 main, master 等)
|
||||
BRANCH="book" # 目标分支 (可能是 main, master 等)
|
||||
|
||||
set -e # 如果任何命令失败,脚本将退出
|
||||
set -o pipefail # 如果管道中的任何命令失败,则整个管道失败
|
||||
|
||||
Reference in New Issue
Block a user