docs: 📝 更新Windows开机自启动教程,增加详细步骤和注意事项,提升用户体验 #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy VitePress | |
| on: | |
| push: | |
| branches: [ main ] | |
| env: | |
| NODE_VERSION: '20' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build project | |
| run: pnpm docs:build | |
| - name: List build files | |
| run: ls -la docs/.vitepress/dist/ | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vitepress-build | |
| path: docs/.vitepress/dist/ | |
| retention-days: 1 | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: vitepress-build | |
| path: ./dist | |
| - name: List downloaded files | |
| run: ls -la ./dist/ | |
| - name: Upload files to VPS | |
| uses: appleboy/scp-action@v0.1.7 | |
| with: | |
| host: ${{ secrets.VPS_HOST }} | |
| username: ${{ secrets.VPS_USERNAME }} | |
| key: ${{ secrets.VPS_SSH_KEY }} | |
| source: "./dist/*" | |
| target: "/tmp/vitepress-deploy/" | |
| strip_components: 1 | |
| - name: Deploy to VPS | |
| uses: appleboy/ssh-action@v1 | |
| with: | |
| host: ${{ secrets.VPS_HOST }} | |
| username: ${{ secrets.VPS_USERNAME }} | |
| key: ${{ secrets.VPS_SSH_KEY }} | |
| script: | | |
| echo "🚀 开始部署 ChmlFrp 文档..." | |
| sudo rm -rf /www/wwwroot/docs.chmlfrp.cn/* | |
| sudo cp -r /tmp/vitepress-deploy/* /www/wwwroot/docs.chmlfrp.cn/ | |
| sudo chown -R www:www /www/wwwroot/docs.chmlfrp.cn/ 2>/dev/null || sudo chown -R www-data:www-data /www/wwwroot/docs.chmlfrp.cn/ 2>/dev/null || true | |
| sudo find /www/wwwroot/docs.chmlfrp.cn -type f -exec chmod 644 {} \; 2>/dev/null || true | |
| sudo find /www/wwwroot/docs.chmlfrp.cn -type d -exec chmod 755 {} \; 2>/dev/null || true | |
| sudo rm -rf /tmp/vitepress-deploy | |
| echo "✅ ChmlFrp 文档自动部署完成!" |