微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何借助github操作使npm在本地计算机上运行构建?

如何解决如何借助github操作使npm在本地计算机上运行构建?

我的ubuntu服务器上有一个Nuxt Js应用程序。我使用终端输入服务器并在服务器上运行命令。我无法运行命令“ npm run build”,因为我的VPS内存不足并且构建命令冻结。因此,我决定在PC上进行构建,将构建的文件夹复制到VPS,然后运行应用程序。

我应该在github操作中写些什么来执行那些步骤?

-npm运行构建

使用ssh(或密码,没关系)将构建的文件夹从我的计算机复制到VPS到VPS上的特定文件

我上次做的对我有用:

name: Deployment Setup

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  job-one:
    name: Deploy
    runs-on: ubuntu-latest
    steps:
      - name: Testing VPS connection and deploy project
        uses: appleboy/ssh-action@master
        with:
          host: 114.12.587.105
          port: 1234
          username: new-user
          key: ${{ secrets.PRIVATE_KEY}}
          uses: appleboy/ssh-action@master
          script: |
            cd /home/kentforth/webapps/myapp
            git pull
            npm install --production
            quasar build
            sudo service Nginx restart

编辑: 这是我的deploy.yml文件

name: 'test my project'
on:
  push:
    branches:
      - master

jobs:
  deploy:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [10.x,12.x,14.x]
    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - run: npm run build

这是我在github动作中得到的内容

error

似乎github动作试图找到路径/ home / runner / work /我的项目名称 但是我没有这样的目录

如何在运行“ npm run build”命令的本地计算机上指定文件夹?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。