upload
This commit is contained in:
2
.build/build-assets.sh
Executable file → Normal file
2
.build/build-assets.sh
Executable file → Normal file
@@ -6,7 +6,7 @@ export NODE_OPTIONS="--max-old-space-size=8192"
|
|||||||
cd assets
|
cd assets
|
||||||
rm -rf build
|
rm -rf build
|
||||||
yarn install --network-timeout 1000000
|
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
|
yarn run build
|
||||||
|
|
||||||
# Copy the build files to the application directory
|
# Copy the build files to the application directory
|
||||||
|
|||||||
0
.build/entrypoint.sh
Executable file → Normal file
0
.build/entrypoint.sh
Executable file → Normal file
2
assets
2
assets
Submodule assets updated: 7b8f6c02e9...921570f229
BIN
assets.zip
Normal file
BIN
assets.zip
Normal file
Binary file not shown.
54
build.sh
Normal file
54
build.sh
Normal file
@@ -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 "========================================"
|
||||||
BIN
go1.25.0.linux-amd64.tar.gz
Normal file
BIN
go1.25.0.linux-amd64.tar.gz
Normal file
Binary file not shown.
10
node_modules/.yarn-integrity
generated
vendored
Normal file
10
node_modules/.yarn-integrity
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"systemParams": "linux-x64-109",
|
||||||
|
"modulesFolders": [],
|
||||||
|
"flags": [],
|
||||||
|
"linkedModules": [],
|
||||||
|
"topLevelPatterns": [],
|
||||||
|
"lockfileEntries": {},
|
||||||
|
"files": [],
|
||||||
|
"artifacts": {}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user