This commit is contained in:
parent
8121b07b1c
commit
2567534a9d
@ -30,27 +30,31 @@ jobs:
|
|||||||
echo "Using system Node.js"
|
echo "Using system Node.js"
|
||||||
node --version
|
node --version
|
||||||
npm --version
|
npm --version
|
||||||
# 确保 Node.js 在 PATH 中
|
|
||||||
export PATH=$(dirname $(which node)):$PATH
|
|
||||||
|
|
||||||
- name: Install dependencies
|
# 检查并安装依赖(如果需要)
|
||||||
run: npm install
|
- name: Install dependencies if needed
|
||||||
|
run: |
|
||||||
|
if [ ! -d "node_modules" ]; then
|
||||||
|
echo "node_modules not found, installing dependencies..."
|
||||||
|
npm install
|
||||||
|
else
|
||||||
|
echo "node_modules already exists, skipping installation"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 构建项目
|
||||||
- name: Build project
|
- name: Build project
|
||||||
run: npm run build
|
run: |
|
||||||
|
npm run build
|
||||||
|
|
||||||
- name: Package dist folder
|
# 直接移动 dist 目录到目标位置
|
||||||
|
- 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
|
||||||
zip -r frontend-dist.zip dist
|
echo "Dist directory found, moving to /yantoo/frontend/"
|
||||||
sudo mv frontend-dist.zip /yantoo/frontend/
|
sudo rm -rf /yantoo/frontend/*
|
||||||
|
sudo cp -r dist/* /yantoo/frontend/
|
||||||
- name: Extract package in target directory
|
echo "Files successfully moved to /yantoo/frontend/"
|
||||||
run: |
|
|
||||||
cd /yantoo/frontend/
|
|
||||||
sudo unzip -o frontend-dist.zip
|
|
||||||
sudo rm frontend-dist.zip
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user