This commit is contained in:
parent
372e169f5a
commit
786f6889ef
@ -24,40 +24,48 @@ jobs:
|
|||||||
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
||||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
||||||
|
|
||||||
# 使用系统已安装的 Node.js v23.5.0
|
# 设置环境和 Node.js
|
||||||
- name: Use system Node.js v23.5.0
|
- name: Setup environment
|
||||||
run: |
|
run: |
|
||||||
echo "Using system Node.js"
|
echo "Setting up environment..."
|
||||||
node --version
|
node --version
|
||||||
npm --version
|
npm --version
|
||||||
|
|
||||||
|
# 设置多个可能解决 crypto 问题的环境变量
|
||||||
|
export NODE_OPTIONS="--no-warnings"
|
||||||
|
export VITE_CJS_IGNORE_WARNING=true
|
||||||
|
export NODE_NO_WARNINGS=1
|
||||||
|
|
||||||
# 检查并安装依赖(如果需要)
|
# 安装依赖
|
||||||
- name: Install dependencies if needed
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
if [ ! -d "node_modules" ]; then
|
echo "Installing dependencies..."
|
||||||
echo "node_modules not found, installing dependencies..."
|
# 使用 --legacy-peer-deps 避免依赖冲突
|
||||||
npm install
|
npm install --legacy-peer-deps
|
||||||
else
|
|
||||||
echo "node_modules already exists, skipping installation"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 构建项目
|
# 构建项目
|
||||||
- name: Build project
|
- name: Build project
|
||||||
run: |
|
run: |
|
||||||
npm run build --legacy-peer-deps
|
echo "Building project..."
|
||||||
|
# 设置环境变量
|
||||||
|
export NODE_OPTIONS="--no-warnings"
|
||||||
|
export VITE_CJS_IGNORE_WARNING=true
|
||||||
|
|
||||||
|
# 执行构建
|
||||||
|
npm run build
|
||||||
|
|
||||||
# 将 dist 目录移动到目标位置
|
# 移动构建产物
|
||||||
- name: Move dist folder to target directory
|
- name: Move dist folder to target directory
|
||||||
run: |
|
run: |
|
||||||
if [ ! -d "dist" ]; then
|
if [ ! -d "dist" ]; then
|
||||||
echo "Error: dist directory not found"
|
echo "Error: dist directory not found"
|
||||||
ls -la
|
ls -la
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Dist directory found, moving to /yantoo/frontend/study-online/"
|
echo "Dist directory found, moving to /yantoo/frontend/study-online/"
|
||||||
|
|
||||||
sudo rm -rf /yantoo/frontend/study-online/*
|
sudo mkdir -p /yantoo/frontend/study-online
|
||||||
|
sudo rm -rf /yantoo/frontend/study-online/*
|
||||||
sudo cp -r dist/* /yantoo/frontend/study-online/
|
sudo cp -r dist/* /yantoo/frontend/study-online/
|
||||||
|
|
||||||
echo "Files successfully moved to /yantoo/frontend/study-online/"
|
echo "Files successfully moved to /yantoo/frontend/study-online/"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user