diff --git a/.build/build-assets.sh b/.build/build-assets.sh old mode 100755 new mode 100644 index fc35c72..606575d --- a/.build/build-assets.sh +++ b/.build/build-assets.sh @@ -6,7 +6,7 @@ export NODE_OPTIONS="--max-old-space-size=8192" cd assets rm -rf build yarn install --network-timeout 1000000 -yarn version --new-version $1 --no-git-tag-version +# yarn version --new-version $1 --no-git-tag-version yarn run build # Copy the build files to the application directory diff --git a/.build/entrypoint.sh b/.build/entrypoint.sh old mode 100755 new mode 100644 diff --git a/assets b/assets index 7b8f6c0..921570f 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 7b8f6c02e93d83428eb6c454e5b68f2235df371a +Subproject commit 921570f2296236cfda2ef1c944f0b97f9dc7e7df diff --git a/assets.zip b/assets.zip new file mode 100644 index 0000000..6e15500 Binary files /dev/null and b/assets.zip differ diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..63bf081 --- /dev/null +++ b/build.sh @@ -0,0 +1,54 @@ +#!/bin/bash +set -e + +# 1. 记录起始时间(用 %s 取整数秒,避免小数运算依赖 bc) +start_seconds=$(date +%s) +start_datetime=$(date +"%Y-%m-%d %H:%M:%S") +echo "========================================" +echo "Build started at: $start_datetime" +echo "========================================" + + +# 2. 构建前端(统计耗时) +echo -e "\n[1/2] Starting frontend build..." +frontend_start=$(date +%s) # 前端开始时间(整数秒) + +chmod +x ./.build/build-assets.sh +./.build/build-assets.sh + +# 计算前端耗时(整数秒,直接用 bash 内置减法,无需 bc) +frontend_end=$(date +%s) +frontend_duration=$((frontend_end - frontend_start)) +echo "[1/2] Frontend build completed! (Time: ${frontend_duration}s)" + + +# 3. 构建后端(统计耗时) +echo -e "\n[2/2] Starting backend build..." +backend_start=$(date +%s) # 后端开始时间(整数秒) + +# 获取 Git 版本和 Commit +export COMMIT_SHA=$(git rev-parse --short HEAD) +export VERSION=$(git describe --tags) +echo "Backend version: $VERSION, Commit: $COMMIT_SHA" + +# 编译 Go 后端 +go build -a -o cloudreve \ + -ldflags "-s -w -X 'github.com/cloudreve/Cloudreve/v4/application/constants.BackendVersion=$VERSION' -X 'github.com/cloudreve/Cloudreve/v4/application/constants.LastCommit=$COMMIT_SHA'" + +# 计算后端耗时 +backend_end=$(date +%s) +backend_duration=$((backend_end - backend_start)) +echo "[2/2] Backend build completed! (Time: ${backend_duration}s)" + + +# 4. 总耗时统计(整数秒,直观易懂) +end_seconds=$(date +%s) +total_duration=$((end_seconds - start_seconds)) +end_datetime=$(date +"%Y-%m-%d %H:%M:%S") + +echo -e "\n========================================" +echo "Build successfully completed!" +echo "Total duration: ${total_duration}s" +echo "Started at: $start_datetime" +echo "Ended at: $end_datetime" +echo "========================================" \ No newline at end of file diff --git a/go1.25.0.linux-amd64.tar.gz b/go1.25.0.linux-amd64.tar.gz new file mode 100644 index 0000000..c184d2c Binary files /dev/null and b/go1.25.0.linux-amd64.tar.gz differ diff --git a/node_modules/.yarn-integrity b/node_modules/.yarn-integrity new file mode 100644 index 0000000..9f89cae --- /dev/null +++ b/node_modules/.yarn-integrity @@ -0,0 +1,10 @@ +{ + "systemParams": "linux-x64-109", + "modulesFolders": [], + "flags": [], + "linkedModules": [], + "topLevelPatterns": [], + "lockfileEntries": {}, + "files": [], + "artifacts": {} +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..fb57ccd --- /dev/null +++ b/yarn.lock @@ -0,0 +1,4 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + +