update main.yml

This commit is contained in:
2026-02-07 17:17:57 +08:00
parent 821409004a
commit 485d067a27

View File

@@ -11,19 +11,18 @@ env:
jobs:
deploy:
runs-on: ubuntu-latest # 请确保你的 runner config.yaml 中定义了此标签
runs-on: ubuntu-latest
steps:
- name: 检查分支
uses: actions/checkout@v4
with:
fetch-depth: 1 # 2H2G 环境下减少拉取深度,加速构建
fetch-depth: 1
- name: 缓存项目 npm 包
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
# 基于 package-lock.json 生成 key
key: ${{ runner.os }}-nodeModules-${{ hashFiles('package-lock.json') }}
- name: 安装 Node.js
@@ -33,7 +32,6 @@ jobs:
- name: 安装依赖与构建
run: |
npm install -g hexo-cli
npm install
npm run clean
@@ -46,16 +44,13 @@ jobs:
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan git.biss.click >> ~/.ssh/known_hosts
cd ./public
git init
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@noreply.gitea.com"
git add .
git commit -m "Deploy: ${{ github.event.head_commit.message }} [$(date +'%Y-%m-%d %H:%M:%S')]"
git push --force "git@git.biss.click:biss/blog.git" master:page
- name: 通知服务器 Hook