docs: 1panel 增加反代设置 #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 标题 | |
name: GitHub Actions 部署 vitepress 博客 | |
# 触发时机:表示推送master分支时触发 | |
on: | |
push: | |
branches: | |
- master | |
# 任务列表 | |
jobs: | |
build-and-deploy: | |
# 运行环境 | |
runs-on: ubuntu-latest | |
# 步骤 | |
steps: | |
# 步骤1:安装Node.js | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
# 步骤2:检出代码 | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# 步骤3:安装yarn | |
- name: Install yarn | |
run: npm install -g yarn | |
# 步骤4:安装依赖 | |
- name: Install dependencies | |
run: yarn install | |
# 步骤5:构建VitePress | |
- name: Build VitePress | |
run: yarn run docs:build | |
# 步骤6:部署到Github Pages | |
# - name: Deploy to Github Pages | |
# uses: peaceiris/actions-gh-pages@v3 | |
# with: | |
# github_token: ${{ secrets.VITEPRESS_BLOG_TOKEN }} # 自定义的action环境变量 | |
# publish_dir: .vitepress/dist # 指定部署目录 | |
# publish_branch: gh-pages # 指定部署分支 | |
# dotfiles: true # 允许使用.gitignore文件 | |
# 步骤7: scp部署到 vps | |
- name: Deploy to VPS | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} # 服务器地址 | |
username: ${{ secrets.SERVER_USER }} # 服务器用户名 | |
port: ${{ secrets.SERVER_PORT }} # 服务器端口 | |
key: ${{ secrets.SERVER_SSH_KEY }} # 服务器SSH 密钥 | |
# password: ${{ secrets.SERVER_USER_PASSWORD }} # 服务器用户密码 | |
strip_components: 2 # 跳过指定目录 | |
source: '.vitepress/dist' # 源目录 | |
target: ${{ secrets.SERVER_TARGET }} # 目标目录 |