11
This commit is contained in:
@@ -11,23 +11,14 @@ env:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
# 确保你的 runner config.yaml 中定义了此标签
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 检查分支
|
- name: 检查分支
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
# 重要:在 1.25+ 版本中,禁用默认凭据以避免与 SSH 密钥冲突
|
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: 缓存项目 npm 包
|
|
||||||
id: cache-node-modules
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-nodeModules-${{ hashFiles('package-lock.json') }}
|
|
||||||
|
|
||||||
- name: 安装 Node.js
|
- name: 安装 Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
@@ -37,41 +28,33 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
npm install -g hexo-cli
|
npm install -g hexo-cli
|
||||||
npm install
|
npm install
|
||||||
npm run clean
|
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
- name: 强制调试部署
|
- name: 强制调试部署 (强制输出所有信息)
|
||||||
env:
|
env:
|
||||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
run: |
|
|
||||||
# 1. 验证私钥是否加载成功
|
|
||||||
if [ -z "$SSH_PRIVATE_KEY" ]; then
|
|
||||||
echo "错误: 仓库 Secrets 中的 SSH_PRIVATE_KEY 是空的!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
|
|
||||||
chmod 600 ~/.ssh/id_ed25519
|
|
||||||
|
|
||||||
# 2. 详细测试 SSH 连接 (不使用 quiet,强制显示结果)
|
|
||||||
ssh-keyscan -p 22 git.biss.click >> ~/.ssh/known_hosts
|
|
||||||
ssh -vT -i ~/.ssh/id_ed25519 git@git.biss.click || true
|
|
||||||
|
|
||||||
# 3. 部署并移除 --quiet,打印所有 Git 原始报错
|
|
||||||
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: $(date)"
|
|
||||||
|
|
||||||
# 开启环境变量调试输出
|
|
||||||
export GIT_SSH_COMMAND="ssh -v -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=no"
|
|
||||||
|
|
||||||
# 推送时删除 --quiet
|
|
||||||
git push --force -v "git@git.biss.click:biss/blog.git" master:pages
|
|
||||||
|
|
||||||
- name: 通知服务器 Hook
|
|
||||||
run: |
|
run: |
|
||||||
curl -k -X POST "https://45.145.229.95:40606/hook?access_key=1XJG8IvYTSZVvD5dpm86GYIpQxgxBcucULnX1MFskZSKayXU"
|
# 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
|
||||||
Reference in New Issue
Block a user