创建自动部署Action #1
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: 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 }} |