[add]:添加加载动图 #95
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 Hexo Blog | |
| on: | |
| push: | |
| branches: [ source ] | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' # 启用 npm 缓存,减少重复下载 | |
| - name: Install dependencies and build | |
| run: | | |
| # 关键:切换为国内淘宝镜像,彻底解决 429 限制 | |
| npm config set registry https://registry.npmmirror.com/ | |
| # 清除缓存,避免镜像切换不生效 | |
| npm cache clean --force | |
| # 安装依赖(全局和项目依赖都用国内镜像) | |
| npm install -g hexo-cli --registry=https://registry.npmmirror.com/ | |
| npm install --registry=https://registry.npmmirror.com/ | |
| # 构建静态文件 | |
| hexo clean | |
| hexo generate | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| deploy_key: ${{ secrets.HEXO_DEPLOY_PRI }} | |
| publish_dir: ./public | |
| publish_branch: main # 与 _config.yml 中的 deploy.branch 一致 |