update main.yml
This commit is contained in:
@@ -6,9 +6,6 @@ on:
|
|||||||
- master
|
- master
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
|
||||||
TZ: Asia/Shanghai
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -17,12 +14,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
persist-credentials: false
|
persist-credentials: false # 必须为 false,防止 1.25.4 的默认 Token 干扰 SSH
|
||||||
|
|
||||||
- name: 安装 Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: "22"
|
|
||||||
|
|
||||||
- name: 安装依赖与构建
|
- name: 安装依赖与构建
|
||||||
run: |
|
run: |
|
||||||
@@ -30,31 +22,30 @@ jobs:
|
|||||||
npm install
|
npm install
|
||||||
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: |
|
run: |
|
||||||
# 1. 设置 SSH
|
# 1. 注入 SSH 密钥
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
|
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
|
||||||
chmod 600 ~/.ssh/id_ed25519
|
chmod 600 ~/.ssh/id_ed25519
|
||||||
|
ssh-keyscan git.biss.click >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
# 2. 强制打印 SSH 握手日志,看看是哪一步断了
|
# 2. 准备推送
|
||||||
# 这里如果没有输出内容,说明网络解析 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
|
cd ./public
|
||||||
git init
|
git init
|
||||||
git config user.name "${{ github.actor }}"
|
git config user.name "biss"
|
||||||
git config user.email "${{ github.actor }}@noreply.gitea.com"
|
git config user.email "biss@noreply.gitea.com"
|
||||||
git add .
|
|
||||||
git commit -m "Debug Deploy"
|
|
||||||
|
|
||||||
# 5. 关键:强制 Git 输出详细过程
|
# 3. 针对 2H2G 的内存优化:限制 Git 的打包内存占用
|
||||||
# 绝对不要加 --quiet
|
git config --global pack.windowMemory "16m"
|
||||||
GIT_SSH_COMMAND="ssh -v -i ~/.ssh/id_ed25519" git push --force -v "git@git.biss.click:biss/blog.git" master:page 2>&1
|
git config --global pack.packSizeLimit "20m"
|
||||||
|
git config --global core.packedGitLimit "32m"
|
||||||
|
|
||||||
|
git add .
|
||||||
|
git commit -m "Deploy: $(date)"
|
||||||
|
|
||||||
|
# 4. 执行推送 (去掉 -v 防止日志过大导致内存波动)
|
||||||
|
# 注意:如果端口不是 22,请确保地址包含端口号
|
||||||
|
git push --force "git@git.biss.click:biss/blog.git" master:page 2>&1
|
||||||
Reference in New Issue
Block a user