# This is a basic workflow to help you get started with Actionsname: CI# Controls when the action will run. on:# Triggers the workflow on push or pull request events but only for the master branchpush:branches: [ master ]pull_request:branches: [ master ]# 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 parallel jobs:# 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- uses: actions/setup-node@v2 #nodejs 环境with:node-version: '14'#nodejs 版本- run: yarn install#安装依赖- run: yarn build:prod #打包- name: Tar dist filerun: |tar -zcvf webapp.tar.gz dist # 打包dist文件夹- name: Scp_upload_tar_file # 上传至服务器uses: garygrossgarten/github-action-scp@releasewith:local: 'webapp.tar.gz'remote: '/home/webapp.tar.gz'host: ${{ secrets.HOST }}username: ${{ secrets.USERNAME }}password: ${{ secrets.PASSWORD }}port: ${{ secrets.PORT }}- name: Deploy_app_tar #解压压缩包uses: appleboy/ssh-action@masterwith:host: ${{ secrets.HOST }}username: ${{ secrets.USERNAME }}password: ${{ secrets.PASSWORD }}port: ${{ secrets.PORT }}script: |cd /home/rm -rf disttar -zxvf webapp.tar.gzrm -rf /var/html/webappmv dist /var/html/webapp