undo packave v upgrade #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to EC2 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up SSH | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.EC2_SSH_KEY }} | |
- name: Deploy to EC2 | |
run: | | |
ssh -o StrictHostKeyChecking=no [email protected] << 'EOF' | |
# Navigate to your project directory | |
cd /var/www/allo-experts-frontend | |
# Pull the latest changes from the main branch | |
sudo git pull origin main | |
# Install dependencies | |
sudo npm install > output.log 2>&1 | |
# Build the project | |
sudo npm run build >> output.log 2>&1 | |
# Start or restart the application using PM2 | |
sudo pm2 start npm --name "allo-experts-frontend" -- run start >> output.log 2>&1 || pm2 restart "allo-experts-frontend" >> output.log 2>&1 | |
# Save the PM2 process list | |
sudo pm2 save >> output.log 2>&1 | |
EOF |