Skip to content

Commit

Permalink
feat: added github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Pulkitxm committed Sep 20, 2024
1 parent 3d69246 commit eb67e50
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build & Deploy
on:
push:
branches: [main]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Deploy NodeJS app to Vultr
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
key: ${{ secrets.SSH_KEY }}
username: ${{ secrets.SSH_USERNAME }}
script: |
# Stop if present
pm2 stop devpulkit
# Navigate to the project directory
rm -rf /root/devpulkit.in
cd /root
# Clone the repository
git clone https://github.com/pulkitxm/devpulkit.in
# Ensure Node.js and npm are available
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# Install dependencies
npm install
# Build the project
npm run build
# Install PM2 globally if not already installed
npm install pm2@latest -g
# Restart the application using PM2
pm2 start npm --name "devpulkit" -- start
echo 'Deployment successful to Vultr'

0 comments on commit eb67e50

Please sign in to comment.