name: Build app and deploy to aliyunon: # 监听 main 分支上的 push 事件push:
branches:
- main# Allows you to run this workflow manually from the Actions tabworkflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in paralleljobs:
# This workflow contains a single job called "build"build:
# The type of runner that the job will run onruns-on: ubuntu-latest# Steps represent a sequence of tasks that will be executed as part of the jobsteps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2# 执行npm脚本打包项目
- name: Install and Buildrun: | npm install npm run build
- name: Deployuses: easingthemes/[email protected]env:
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}ARGS: '-rltgoDzvO --delete'SOURCE: dist/ # 这是要复制到阿里云静态服务器的文件夹名称REMOTE_HOST: '39.105.150.167'# 阿里云公网地址REMOTE_PORT: '22'REMOTE_USER: root # 阿里云登录后默认为 root 用户,并且所在文件夹为 rootTARGET: /www/m/vue-ci # 打包后的 dist 文件夹将放在 **** (对应 nginx 映射的地址)