update main.yml
This commit is contained in:
@@ -11,12 +11,15 @@ 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
|
||||||
|
|
||||||
- name: 缓存项目 npm 包
|
- name: 缓存项目 npm 包
|
||||||
id: cache-node-modules
|
id: cache-node-modules
|
||||||
@@ -39,18 +42,22 @@ jobs:
|
|||||||
|
|
||||||
- name: 部署到 Gitea Page 分支
|
- name: 部署到 Gitea Page 分支
|
||||||
env:
|
env:
|
||||||
|
# 确保在仓库 Secrets 中已添加此私钥
|
||||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
run: |
|
run: |
|
||||||
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
|
ssh-keyscan git.biss.click >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
cd ./public
|
cd ./public
|
||||||
git init
|
git init
|
||||||
git config user.name "${{ github.actor }}"
|
git config user.name "${{ github.actor }}"
|
||||||
git config user.email "${{ github.actor }}@noreply.gitea.com"
|
git config user.email "${{ github.actor }}@noreply.gitea.com"
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Deploy: ${{ github.event.head_commit.message }} [$(date +'%Y-%m-%d %H:%M:%S')]"
|
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
|
git push --force "git@git.biss.click:biss/blog.git" master:page
|
||||||
|
|
||||||
- name: 通知服务器 Hook
|
- name: 通知服务器 Hook
|
||||||
|
|||||||
Reference in New Issue
Block a user