Skip to content

Create main.yml

Create main.yml #1

Workflow file for this run

name: Deploy new Branch
on:
push:
branches: [new]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install SSH Key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Deploy to EC2
run: |
ssh -o StrictHostKeyChecking=no [email protected] "
cd /var/www/your-repo &&
git fetch origin new:new &&
git checkout new &&
npm install &&
npm run build &&
sudo systemctl restart nginx
"