name: Build Hexo Site on: push: branches: [main, master] workflow_dispatch: jobs: build: runs-on: ubuntu-latest # 不加 container,直接用宿主机的 node v22 steps: - name: Checkout code run: | git clone "http://172.17.0.1:3000/${{ github.repository }}.git" . git checkout "${{ github.sha }}" - name: Install dependencies run: npm install - name: Build Hexo run: npm run build - name: Deploy to HTML directory run: | rm -rf /home/ubuntu/html/* cp -r public/* /home/ubuntu/html/ echo "✅ 构建完成!" ls -la /home/ubuntu/html/