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