60 lines
1.8 KiB
YAML
60 lines
1.8 KiB
YAML
name: 自动部署
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
TZ: Asia/Shanghai
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: 检查分支
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
persist-credentials: false
|
|
|
|
- name: 安装 Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
|
|
- name: 安装依赖与构建
|
|
run: |
|
|
npm install -g hexo-cli
|
|
npm install
|
|
npm run build
|
|
|
|
- name: 强制调试部署 (强制输出所有信息)
|
|
env:
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
run: |
|
|
# 1. 设置 SSH
|
|
mkdir -p ~/.ssh
|
|
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
|
|
chmod 600 ~/.ssh/id_ed25519
|
|
|
|
# 2. 强制打印 SSH 握手日志,看看是哪一步断了
|
|
# 这里如果没有输出内容,说明网络解析 git.biss.click 就已经挂了
|
|
ssh-keyscan -v git.biss.click >> ~/.ssh/known_hosts 2>&1
|
|
|
|
# 3. 模拟 Git 内部的 SSH 详细连接测试
|
|
# 这一行一定会输出大量的日志,哪怕是报错
|
|
ssh -vT -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=no git@git.biss.click 2>&1 || true
|
|
|
|
# 4. 准备推送
|
|
cd ./public
|
|
git init
|
|
git config user.name "${{ github.actor }}"
|
|
git config user.email "${{ github.actor }}@noreply.gitea.com"
|
|
git add .
|
|
git commit -m "Debug Deploy"
|
|
|
|
# 5. 关键:强制 Git 输出详细过程
|
|
# 绝对不要加 --quiet
|
|
GIT_SSH_COMMAND="ssh -v -i ~/.ssh/id_ed25519" git push --force -v "git@git.biss.click:biss/blog.git" master:page 2>&1 |