Skip to content

Create deploy.yml

Create deploy.yml #1

Workflow file for this run

name: Deploy React App
on:
push:
branches:
- dev # Adjust this to your main branch
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18.17.1' # Adjust this to your required Node version
- name: Install dependencies
run: pnpm install
- name: Build project
run: pnpm run build
- name: Postbuild project
run: pnpm run postbuild
- name: Deploy to server
uses: appleboy/ssh-action@v0.1.6
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
passphrase: ${{ secrets.SERVER_SSH_PASSPHRASE }}
script: |
rm -rf /var/www/INSIGHTS/dist
scp -r ./build/* user@host:/var/www/INSIGHTS/