deploying a nodejs / react application on aws ec2 with github actions
I'm looking for a little help.
I have a react/node js app being deployed to an ec2 instance with github actions.
Here is my yaml file:
on:
push:
branches: [ "main" ]
jobs:
build:
runs-on: self-hosted
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- name: Clear contents of /var/www/html
run: sudo rm -rf /var/www/html/*
- name: Copy dist folder to /var/www/html
run: sudo cp -Rv dist/* /var/www/html

I'm not sure why that is.. can somebody help me?
Thanks
Chris