How to deploy nuxt proj with circleci once have new commit to github

Recently I made a dev branch for myrepo in GitHub, I deploy the Nuxt app by running sh in my ubuntu server (digitalocean droplet). I found that manually redeploying my project to the server every time after pushing commits is quite time-consuming; therefore, I tried to find ways to automatically deploy the app once I make a new commit on dev branch. I have read some documentation about CircleCI, but I’m still so confused. I’ve added the ssh key in the CircleCI project for myrepo, added it as steps: - add-fingerprints -"FI:GE:RP:RI:T" to the config.yml then I’m stuck with the connection problem and how should I actually run the . How should I do the config if i want to:

  1. run the test only when dev has new commit
  2. try if the project can actually build
  3. deploy the project to the server by running the sh script

Here is the config.yml

version: 2
      - image: circleci/node:10.19.0
    working_directory: ~/dev
      - checkout
      - run: npm install
      - run: npm run build

      enabled: true
      - add_ssh_keys:
            - "FI:GE:RP:RI:T"
      - run:
          name: Deploy Over SSH
          command: |
             ssh USER@ADDRESS "sh dev/"
  version: 2
      - build
      - deploy

Here is the

pm2 stop dev
cd ~/dev/Myrepo
git checkout dev
git fetch
git pull
npm install
cp ../.env .env
npm run build
pm2 restart dev