Merge branch 'main' of github.com:kongying-tavern/docs #381
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: DEPLOYMENT | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录 | |
fetch-depth: 0 | |
- name: Set node version to 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Cache pnpm modules | |
uses: actions/cache@v2 | |
with: | |
path: ~/.pnpm-store | |
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}- | |
- name: Install dependencies | |
uses: pnpm/action-setup@v2 | |
with: | |
run_install: true | |
# 构建 | |
- name: Build | |
run: pnpm build | |
# 部署 | |
- name: Deploy | |
uses: easingthemes/[email protected] | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.ACCESS_TOKEN }} | |
# 删除服务器上目录里所有文件 | |
# ARGS: '-avz --delete' | |
# 项目 build 后静态文件位置 | |
SOURCE: './dist/' | |
REMOTE_HOST: ${{ secrets.REMOTE_HOST }} | |
REMOTE_PORT: ${{ secrets.REMOTE_PORT }} | |
REMOTE_USER: ${{ secrets.REMOTE_USER }} | |
TARGET: ${{ secrets.TARGET }} |