Skip to content

20251210

20251210 #58

Workflow file for this run

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@v2
with:
fetch-depth: 0
- name: 安装 Node
uses: actions/setup-node@v1
with:
node-version: "22.x"
- name: 缓存 Hexo
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: 安装依赖
if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
run: |
npm install gulp-cli -g
npm ci
# npm install hexo-algolia --save
- name: 安装 Anzhiyu 主题
run: |
git clone -b main https://github.com/anzhiyu-c/hexo-theme-anzhiyu.git themes/anzhiyu
npm install hexo-renderer-pug hexo-renderer-stylus --save
npm install
# 如果你的主题有其他依赖,也在这里安装
- name: 生成静态文件
run: |
npx hexo clean
npx hexo bangumi -u #bilibili番剧更新
npx hexo generate
# npx hexo algolia
# gulp
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public