name: Release
run-name: ${{ gitea.actor }} is deploying project to test server 🚀
on:
  push:
    branches:
      - develop
jobs:
  lint:
    on: [push, pull_request]
    runs-on: linux_amd64
    steps:
      - name: 拉取代码
        uses: actions/checkout@v4
      - name: 安装依赖
        run: pnpm i
      - name: 执行Lint检查
        run: pnpm lint:eslint
  Release:
    runs-on: linux_amd64
    needs:
      - lint
    steps:
      - name: 拉取代码
        uses: actions/checkout@v3
      - name: 安装依赖
        run: pnpm i
      - name: 执行打包
        run: pnpm build
      - name: 部署到服务器
        uses: actions/ssh-deploy@main
        with:
          SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
          ARGS: "-rlgoDzvc -i"
          SOURCE: dist/
          REMOTE_HOST: ${{ vars.NGINX_SERVER }}
          REMOTE_USER: ${{ vars.NGINX_SERVER_USER }}
          TARGET: ${{ vars.WWW_ROOT }}${{ vars.IMS_DOMAIN }}
          EXCLUDE: ""
          SCRIPT_BEFORE: ${{ vars.BAKUP_SCRIPT }} ${{ vars.IMS_DOMAIN  }}
          SCRIPT_AFTER: echo $RSYNC_STDOUT
