39 lines
1.1 KiB
YAML
39 lines
1.1 KiB
YAML
|
name: Build and deploy to dev server
|
||
|
on:
|
||
|
push:
|
||
|
workflow_dispatch:
|
||
|
|
||
|
permissions:
|
||
|
contents: write
|
||
|
|
||
|
env:
|
||
|
npm_config_registry: ${{ vars.REGISTRY_URL }}
|
||
|
|
||
|
jobs:
|
||
|
Deploy:
|
||
|
runs-on: ubuntu-20.04
|
||
|
steps:
|
||
|
- name: Checkout code
|
||
|
uses: actions/checkout@v3
|
||
|
- name: Setup pnpm
|
||
|
uses: pnpm/action-setup@v4
|
||
|
- name: Setup Node.js
|
||
|
uses: actions/setup-node@v4
|
||
|
with:
|
||
|
node-version: 18.20.3
|
||
|
registry-url: ${{ vars.REGISTRY_URL }}
|
||
|
cache: 'pnpm'
|
||
|
- name: Install deps
|
||
|
run: pnpm install
|
||
|
- name: Build
|
||
|
run: pnpm build
|
||
|
- name: Deploy to Server
|
||
|
uses: easingthemes/ssh-deploy@v2.1.5
|
||
|
env:
|
||
|
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
|
||
|
ARGS: '-rltgoDzvO --delete'
|
||
|
SOURCE: dist # 这是要复制到阿里云静态服务器的文件夹名称
|
||
|
REMOTE_HOST: '192.168.0.19' # 你的阿里云公网地址
|
||
|
REMOTE_USER: root # 阿里云登录后默认为 root 用户,并且所在文件夹为 root
|
||
|
TARGET: /var/www/test/ # 打包后的 dist 文件夹将放在 /root/node-server
|