Github actions how to do npm install only 1 time

Viewed 558

I'm using GitHub actions for deploy. And i need to build vuejs app, every time when pushing. Now all working coorectly, but every time i spend action minutes for npm install.

Can i install modules 1 time, and not reinstall it after every deploy?

on: push
name:  Deploy website on push
jobs:
  web-deploy:
    name:  Deploy
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [15.x]
    steps:

    - name:  Get latest code
      uses: actions/checkout@v2.3.2

    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}

    - run: npm install --legacy-peer-deps     
    - run: npm run build    
    
    - name:  Sync files
      uses: SamKirkland/FTP-Deploy-Action@4.0.0
      with:
        server: ${{ secrets.host}}
        username: ${{ secrets.user}}
        password: ${{ secrets.pass }}
        local-dir: dist/
        dangerous-clean-slate: true
    
0 Answers
Related