update main.yml

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

View File

@@ -11,12 +11,15 @@ env:
jobs:
deploy:
# 确保你的 runner config.yaml 中定义了此标签
runs-on: ubuntu-latest
steps:
- name: 检查分支
uses: actions/checkout@v4
with:
fetch-depth: 1
# 重要:在 1.25+ 版本中,禁用默认凭据以避免与 SSH 密钥冲突
persist-credentials: false
- name: 缓存项目 npm 包
id: cache-node-modules
@@ -39,18 +42,22 @@ jobs:
- name: 部署到 Gitea Page 分支
env:
# 确保在仓库 Secrets 中已添加此私钥
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
run: |
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