Skip to content

Commit

Permalink
Create nodejs.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
tcooperma authored Nov 13, 2024
1 parent bb2dcda commit d38ad37
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Node.js CI/CD on Amazon Linux

on:
push:
branches: [ master ]

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install dependencies
run: npm install

- name: Deploy to AWS EC2
uses: appleboy/scp-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
source: "./" # This now correctly points to the current directory
target: "/var/www/your_project_directory"

- name: Restart PM2 application
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /var/www/your_project_directory
pm2 reload all # This command restarts your application

0 comments on commit d38ad37

Please sign in to comment.