upd #100
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: 自动部署 | |
| on: | |
| push: | |
| branches: | |
| - master | |
| release: | |
| types: | |
| - published | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| steps: | |
| - name: Set Timezone | |
| run: export TZ='Asia/Shanghai' | |
| - name: 检查分支 | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: 安装 Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "22.x" | |
| - name: 启用 Corepack (激活 Yarn 4) | |
| run: corepack enable | |
| - name: 安装 Anzhiyu 主题 | |
| run: | | |
| # 只是克隆主题代码,不需要在这里 install | |
| git clone -b main https://github.com/anzhiyu-c/hexo-theme-anzhiyu.git themes/anzhiyu | |
| - name: 安装项目依赖 | |
| run: | | |
| # 这一步会根据新的 package.json 安装所有东西 | |
| # 包括:hexo核心、渲染器(pug/stylus)、gulp、bangumi插件 | |
| yarn install --immutable | |
| - name: 生成静态文件 | |
| run: | | |
| npx hexo clean | |
| npx hexo bangumi -u | |
| npx hexo generate | |
| # 如果以后需要 gulp,取消注释即可,不需要再安装 gulp-cli | |
| # npx gulp | |
| - name: Deploy | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./public |