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 workflow is now ready to test your code on the runner." | ||||
| 
 | ||||
|       # 使用系统已安装的 Node.js v23.5.0 | ||||
|       - name: Use system Node.js v23.5.0 | ||||
|         run: |           | ||||
|           echo "Using system Node.js" | ||||
|       # 设置环境和 Node.js | ||||
|       - name: Setup environment | ||||
|         run: | | ||||
|           echo "Setting up environment..." | ||||
|           node --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 | ||||
|         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: Install dependencies | ||||
|         run: | | ||||
|           echo "Installing dependencies..." | ||||
|           # 使用 --legacy-peer-deps 避免依赖冲突 | ||||
|           npm install --legacy-peer-deps | ||||
| 
 | ||||
|       # 构建项目 | ||||
|       - name: Build project | ||||
|         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 | ||||
|         run: |           | ||||
|               if [ ! -d "dist" ]; then | ||||
|               echo "Error: dist directory not found" | ||||
|               ls -la | ||||
|               exit 1 | ||||
|               fi | ||||
|               echo "Dist directory found, moving to /yantoo/frontend/study-online/" | ||||
|                      | ||||
|               sudo rm -rf /yantoo/frontend/study-online/* | ||||
|                | ||||
|               sudo cp -r dist/* /yantoo/frontend/study-online/ | ||||
|                | ||||
|               echo "Files successfully moved to /yantoo/frontend/study-online/" | ||||
|         run: | | ||||
|           if [ ! -d "dist" ]; then | ||||
|             echo "Error: dist directory not found" | ||||
|             ls -la | ||||
|             exit 1 | ||||
|           fi | ||||
|           echo "Dist directory found, moving to /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/ | ||||
|            | ||||
|           echo "Files successfully moved to /yantoo/frontend/study-online/" | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 libingxiang
						libingxiang