mirror of
https://github.com/handsomezhuzhu/handsomezhuzhu.github.io.git
synced 2026-02-20 11:50:14 +00:00
测试同步2
This commit is contained in:
34
.github/workflows/deploy.yml
vendored
34
.github/workflows/deploy.yml
vendored
@@ -113,23 +113,17 @@ on:
|
|||||||
env:
|
env:
|
||||||
TZ: Asia/Shanghai
|
TZ: Asia/Shanghai
|
||||||
|
|
||||||
# ===========================
|
# 权限设置
|
||||||
# 权限设置 (关键修改)
|
|
||||||
# ===========================
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
pages: write # GitHub Pages 部署需要
|
pages: write
|
||||||
id-token: write # GitHub Pages 部署需要
|
id-token: write
|
||||||
|
|
||||||
# 并发控制
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: pages
|
group: pages
|
||||||
cancel-in-progress: false
|
cancel-in-progress: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# ==================================================
|
|
||||||
# 任务 1: 构建项目 + 部署到 1Panel + 上传构建产物
|
|
||||||
# ==================================================
|
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
@@ -158,7 +152,7 @@ jobs:
|
|||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
# 分支任务 A: 部署到 1Panel 服务器 (SCP)
|
# 分支任务 A: 部署到 1Panel (路径已修改)
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
- name: Deploy to 1Panel via SCP
|
- name: Deploy to 1Panel via SCP
|
||||||
uses: appleboy/scp-action@master
|
uses: appleboy/scp-action@master
|
||||||
@@ -167,8 +161,15 @@ jobs:
|
|||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
password: ${{ secrets.PASSWORD }}
|
password: ${{ secrets.PASSWORD }}
|
||||||
port: ${{ secrets.PORT }}
|
port: ${{ secrets.PORT }}
|
||||||
|
|
||||||
|
# 源文件 (保持不变)
|
||||||
source: "docs/.vitepress/dist/*"
|
source: "docs/.vitepress/dist/*"
|
||||||
target: "/www/wwwroot/handsome_blog"
|
|
||||||
|
# 【关键修改】目标路径改为 1Panel 指定的路径
|
||||||
|
# 注意:这里假设你在 1Panel 创建网站时,代号填的是 "blog"
|
||||||
|
target: "/opt/1panel/apps/openresty/openresty/www/sites/blog/index"
|
||||||
|
|
||||||
|
# 去掉路径前缀
|
||||||
strip_components: 3
|
strip_components: 3
|
||||||
|
|
||||||
- name: Fix 1Panel Permissions
|
- name: Fix 1Panel Permissions
|
||||||
@@ -179,7 +180,9 @@ jobs:
|
|||||||
password: ${{ secrets.PASSWORD }}
|
password: ${{ secrets.PASSWORD }}
|
||||||
port: ${{ secrets.PORT }}
|
port: ${{ secrets.PORT }}
|
||||||
script: |
|
script: |
|
||||||
chown -R 1000:1000 /www/wwwroot/handsome_blog
|
# 【关键修改】修复新路径的权限
|
||||||
|
# 1Panel 容器通常使用 1000:1000 作为 www 用户
|
||||||
|
chown -R 1000:1000 /opt/1panel/apps/openresty/openresty/www/sites/blog/index
|
||||||
|
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
# 准备分支任务 B: 为 GitHub Pages 上传构建产物
|
# 准备分支任务 B: 为 GitHub Pages 上传构建产物
|
||||||
@@ -187,22 +190,17 @@ jobs:
|
|||||||
- name: Upload artifact for GitHub Pages
|
- name: Upload artifact for GitHub Pages
|
||||||
uses: actions/upload-pages-artifact@v3
|
uses: actions/upload-pages-artifact@v3
|
||||||
with:
|
with:
|
||||||
# 指定构建输出目录 (VitePress 默认为 docs/.vitepress/dist)
|
|
||||||
path: docs/.vitepress/dist
|
path: docs/.vitepress/dist
|
||||||
|
|
||||||
# ==================================================
|
# ==================================================
|
||||||
# 任务 2: 部署到 GitHub Pages (依赖任务 1 完成)
|
# 任务 2: 部署到 GitHub Pages
|
||||||
# ==================================================
|
# ==================================================
|
||||||
deploy-gh-pages:
|
deploy-gh-pages:
|
||||||
needs: build
|
needs: build
|
||||||
|
|
||||||
# 部署环境配置
|
|
||||||
environment:
|
environment:
|
||||||
name: github-pages
|
name: github-pages
|
||||||
url: ${{ steps.deployment.outputs.page_url }}
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
id: deployment
|
id: deployment
|
||||||
|
|||||||
Reference in New Issue
Block a user