mirror of
https://github.com/handsomezhuzhu/handsomezhuzhu.github.io.git
synced 2026-02-20 11:50:14 +00:00
测试同步到阿里云
This commit is contained in:
99
.github/workflows/deploy-old.yml
vendored
Normal file
99
.github/workflows/deploy-old.yml
vendored
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
name: Deploy Pages
|
||||||
|
|
||||||
|
# 触发条件,push到main分支或者pull request到main分支
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
# 支持手动在工作流上触发
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# 设置时区
|
||||||
|
env:
|
||||||
|
TZ: Asia/Shanghai
|
||||||
|
|
||||||
|
# 权限设置
|
||||||
|
permissions:
|
||||||
|
# 允许读取仓库内容的权限。
|
||||||
|
contents: read
|
||||||
|
# 允许写入 GitHub Pages 的权限。
|
||||||
|
pages: write
|
||||||
|
# 允许写入 id-token 的权限。
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
# 并发控制配置
|
||||||
|
concurrency:
|
||||||
|
group: pages
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
# 定义执行任务
|
||||||
|
jobs:
|
||||||
|
# 构建任务
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
# node v20 运行
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [20]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# 拉取代码
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
# 保留 Git 信息
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
# 设置使用 Node.js 版本
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
|
# 使用 最新的 PNPM
|
||||||
|
# 你也可以指定为具体的版本
|
||||||
|
- uses: pnpm/action-setup@v4
|
||||||
|
name: Install pnpm
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
# version: 9
|
||||||
|
run_install: false
|
||||||
|
|
||||||
|
# 安装依赖
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm install --no-frozen-lockfile
|
||||||
|
# 锁定依赖版本
|
||||||
|
# run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
# 构建项目
|
||||||
|
- name: Build blog project
|
||||||
|
run: |
|
||||||
|
echo ${{ github.workspace }}
|
||||||
|
pnpm build
|
||||||
|
|
||||||
|
# 资源拷贝
|
||||||
|
- name: Build with Jekyll
|
||||||
|
uses: actions/jekyll-build-pages@v1
|
||||||
|
with:
|
||||||
|
source: ./docs/.vitepress/dist
|
||||||
|
destination: ./_site
|
||||||
|
|
||||||
|
# 上传 _site 的资源,用于后续部署
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-pages-artifact@v3
|
||||||
|
|
||||||
|
# 部署任务
|
||||||
|
deploy:
|
||||||
|
environment:
|
||||||
|
name: github-pages
|
||||||
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
id: deployment
|
||||||
|
uses: actions/deploy-pages@v4
|
||||||
206
.github/workflows/deploy.yml
vendored
206
.github/workflows/deploy.yml
vendored
@@ -1,99 +1,209 @@
|
|||||||
name: Deploy Pages
|
# name: Deploy Pages
|
||||||
|
|
||||||
# 触发条件,push到main分支或者pull request到main分支
|
# # 触发条件,push到main分支或者pull request到main分支
|
||||||
|
# on:
|
||||||
|
# push:
|
||||||
|
# branches: [main]
|
||||||
|
# pull_request:
|
||||||
|
# branches: [main]
|
||||||
|
|
||||||
|
# # 支持手动在工作流上触发
|
||||||
|
# workflow_dispatch:
|
||||||
|
|
||||||
|
# # 设置时区
|
||||||
|
# env:
|
||||||
|
# TZ: Asia/Shanghai
|
||||||
|
|
||||||
|
# # 权限设置
|
||||||
|
# permissions:
|
||||||
|
# # 允许读取仓库内容的权限。
|
||||||
|
# contents: read
|
||||||
|
# # 允许写入 GitHub Pages 的权限。
|
||||||
|
# pages: write
|
||||||
|
# # 允许写入 id-token 的权限。
|
||||||
|
# id-token: write
|
||||||
|
|
||||||
|
# # 并发控制配置
|
||||||
|
# concurrency:
|
||||||
|
# group: pages
|
||||||
|
# cancel-in-progress: false
|
||||||
|
|
||||||
|
# # 定义执行任务
|
||||||
|
# jobs:
|
||||||
|
# # 构建任务
|
||||||
|
# build:
|
||||||
|
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
# # node v20 运行
|
||||||
|
# strategy:
|
||||||
|
# matrix:
|
||||||
|
# node-version: [20]
|
||||||
|
|
||||||
|
# steps:
|
||||||
|
# # 拉取代码
|
||||||
|
# - name: Checkout
|
||||||
|
# uses: actions/checkout@v4
|
||||||
|
# with:
|
||||||
|
# # 保留 Git 信息
|
||||||
|
# fetch-depth: 0
|
||||||
|
|
||||||
|
# # 设置使用 Node.js 版本
|
||||||
|
# - name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
# uses: actions/setup-node@v4
|
||||||
|
# with:
|
||||||
|
# node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
|
# # 使用 最新的 PNPM
|
||||||
|
# # 你也可以指定为具体的版本
|
||||||
|
# - uses: pnpm/action-setup@v4
|
||||||
|
# name: Install pnpm
|
||||||
|
# with:
|
||||||
|
# version: latest
|
||||||
|
# # version: 9
|
||||||
|
# run_install: false
|
||||||
|
|
||||||
|
# # 安装依赖
|
||||||
|
# - name: Install dependencies
|
||||||
|
# run: pnpm install --no-frozen-lockfile
|
||||||
|
# # 锁定依赖版本
|
||||||
|
# # run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
# # 构建项目
|
||||||
|
# - name: Build blog project
|
||||||
|
# run: |
|
||||||
|
# echo ${{ github.workspace }}
|
||||||
|
# pnpm build
|
||||||
|
|
||||||
|
# # 资源拷贝
|
||||||
|
# - name: Build with Jekyll
|
||||||
|
# uses: actions/jekyll-build-pages@v1
|
||||||
|
# with:
|
||||||
|
# source: ./docs/.vitepress/dist
|
||||||
|
# destination: ./_site
|
||||||
|
|
||||||
|
# # 上传 _site 的资源,用于后续部署
|
||||||
|
# - name: Upload artifact
|
||||||
|
# uses: actions/upload-pages-artifact@v3
|
||||||
|
|
||||||
|
# # 部署任务
|
||||||
|
# deploy:
|
||||||
|
# environment:
|
||||||
|
# name: github-pages
|
||||||
|
# url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# needs: build
|
||||||
|
# steps:
|
||||||
|
# - name: Deploy to GitHub Pages
|
||||||
|
# id: deployment
|
||||||
|
# uses: actions/deploy-pages@v4
|
||||||
|
name: Deploy to 1Panel & GitHub Pages
|
||||||
|
|
||||||
|
# ===========================
|
||||||
|
# 触发条件
|
||||||
|
# ===========================
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
# 支持手动在工作流上触发
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
# 设置时区
|
# 设置时区
|
||||||
env:
|
env:
|
||||||
TZ: Asia/Shanghai
|
TZ: Asia/Shanghai
|
||||||
|
|
||||||
# 权限设置
|
# ===========================
|
||||||
|
# 权限设置 (关键修改)
|
||||||
|
# ===========================
|
||||||
permissions:
|
permissions:
|
||||||
# 允许读取仓库内容的权限。
|
|
||||||
contents: read
|
contents: read
|
||||||
# 允许写入 GitHub Pages 的权限。
|
pages: write # GitHub Pages 部署需要
|
||||||
pages: write
|
id-token: write # GitHub Pages 部署需要
|
||||||
# 允许写入 id-token 的权限。
|
|
||||||
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
|
||||||
|
|
||||||
# node v20 运行
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [20]
|
node-version: [22]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# 拉取代码
|
# 1. 拉取代码
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
# 保留 Git 信息
|
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
# 设置使用 Node.js 版本
|
# 2. 设置 Node.js
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
# 使用 最新的 PNPM
|
# 3. 安装依赖 (npm)
|
||||||
# 你也可以指定为具体的版本
|
|
||||||
- uses: pnpm/action-setup@v4
|
|
||||||
name: Install pnpm
|
|
||||||
with:
|
|
||||||
version: latest
|
|
||||||
# version: 9
|
|
||||||
run_install: false
|
|
||||||
|
|
||||||
# 安装依赖
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install --no-frozen-lockfile
|
run: npm install
|
||||||
# 锁定依赖版本
|
|
||||||
# run: pnpm install --frozen-lockfile
|
|
||||||
|
|
||||||
# 构建项目
|
# 4. 构建项目
|
||||||
- name: Build blog project
|
- name: Build blog project
|
||||||
run: |
|
run: npm run build
|
||||||
echo ${{ github.workspace }}
|
|
||||||
pnpm build
|
|
||||||
|
|
||||||
# 资源拷贝
|
# --------------------------------------------------
|
||||||
- name: Build with Jekyll
|
# 分支任务 A: 部署到 1Panel 服务器 (SCP)
|
||||||
uses: actions/jekyll-build-pages@v1
|
# --------------------------------------------------
|
||||||
|
- name: Deploy to 1Panel via SCP
|
||||||
|
uses: appleboy/scp-action@master
|
||||||
with:
|
with:
|
||||||
source: ./docs/.vitepress/dist
|
host: ${{ secrets.HOST }}
|
||||||
destination: ./_site
|
username: ${{ secrets.USERNAME }}
|
||||||
|
password: ${{ secrets.PASSWORD }}
|
||||||
|
port: ${{ secrets.PORT }}
|
||||||
|
source: "docs/.vitepress/dist/*"
|
||||||
|
target: "/www/wwwroot/handsome_blog"
|
||||||
|
strip_components: 3
|
||||||
|
|
||||||
# 上传 _site 的资源,用于后续部署
|
- name: Fix 1Panel Permissions
|
||||||
- name: Upload artifact
|
uses: appleboy/ssh-action@master
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.HOST }}
|
||||||
|
username: ${{ secrets.USERNAME }}
|
||||||
|
password: ${{ secrets.PASSWORD }}
|
||||||
|
port: ${{ secrets.PORT }}
|
||||||
|
script: |
|
||||||
|
chown -R 1000:1000 /www/wwwroot/handsome_blog
|
||||||
|
|
||||||
|
# --------------------------------------------------
|
||||||
|
# 准备分支任务 B: 为 GitHub Pages 上传构建产物
|
||||||
|
# --------------------------------------------------
|
||||||
|
- name: Upload artifact for GitHub Pages
|
||||||
uses: actions/upload-pages-artifact@v3
|
uses: actions/upload-pages-artifact@v3
|
||||||
|
with:
|
||||||
|
# 指定构建输出目录 (VitePress 默认为 docs/.vitepress/dist)
|
||||||
|
path: docs/.vitepress/dist
|
||||||
|
|
||||||
# 部署任务
|
# ==================================================
|
||||||
deploy:
|
# 任务 2: 部署到 GitHub Pages (依赖任务 1 完成)
|
||||||
|
# ==================================================
|
||||||
|
deploy-gh-pages:
|
||||||
|
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
|
||||||
needs: build
|
|
||||||
steps:
|
steps:
|
||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
id: deployment
|
id: deployment
|
||||||
uses: actions/deploy-pages@v4
|
uses: actions/deploy-pages@v4
|
||||||
Reference in New Issue
Block a user