Skip to content

Commit

Permalink
创建自动部署Action
Browse files Browse the repository at this point in the history
  • Loading branch information
i-mufeng authored Sep 22, 2023
1 parent c0d34ee commit 4db016a
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Mblog 自动部署
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

jobs:
build-and-deploy:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.17.1]

steps:
- uses: actions/checkout@v3

- name: Node.js 版本:${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: 安装pnpm
run: npm install pnpm -g

- name: 安装依赖
run: pnpm install

- name: 打包
run: pnpm run docs:build

- name: 部署到Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
repository-name: i-mufeng/i-mufeng.github.io
clean: true
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
branch: action-pages
folder: docs/.vitepress/dist

- name: 部署到远程服务器
uses: easingthemes/ssh-deploy@main
with:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
ARGS: "-rlgoDzvc -i --delete"
SOURCE: "mblog-press/.vitepress/dist/"
TARGET: ${{ secrets.REMOTE_TARGET }}

0 comments on commit 4db016a

Please sign in to comment.