chore: 触发更新 #196
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: docs | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - test-workflow | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: technote-space/get-diff-action@v4 | |
| with: | |
| PATTERNS: | | |
| +(docs|docs-vuepress|example)/**/* | |
| +(docs|docs-vuepress|example)/.*/**/* | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: '22' | |
| - uses: pnpm/action-setup@v2 | |
| if: env.GIT_DIFF | |
| with: | |
| version: 10 | |
| run_install: | | |
| - recursive: true | |
| args: [--frozen-lockfile, --strict-peer-dependencies] | |
| - name: Upgrade npm to 10 | |
| run: npm install -g npm@10 | |
| # 👉 新增的 step:cd example && npm ci | |
| - name: Install example deps (debug, keep logs) | |
| continue-on-error: true | |
| run: | | |
| set -euo pipefail | |
| echo "Node: $(node --version)" | |
| echo "NPM: $(npm --version)" | |
| echo "PWD: $(pwd && ls -la)" | |
| cd example | |
| npm ci --no-audit --no-fund || true | |
| echo "Listing npm log directory..." | |
| ls -la /home/runner/.npm/_logs || true | |
| - name: Upload npm debug logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: npm-debug-logs | |
| path: /home/runner/.npm/_logs/*.log | |
| # vuepress生成最终文档 | |
| - name: generate docs file | |
| if: env.GIT_DIFF | |
| run: | | |
| pnpm run docs:prod | |
| # 使用 https://github.com/appleboy/scp-action 进行部署,注意 strip_components 用于控制层级 | |
| - name: Deploy to self-host server | |
| if: env.GIT_DIFF | |
| uses: appleboy/scp-action@master | |
| with: | |
| host: ${{ secrets.DOCS_SERVER_HOST }} | |
| username: ${{ secrets.DOCS_SERVER_USER }} | |
| key: ${{ secrets.DOCS_SERVER_KEY }} | |
| command_timeout: "20m" | |
| source: "./docs/.vuepress/dist/" | |
| strip_components: 4 | |
| target: "${{ secrets.DOCS_SERVER_DIR }}" |