Skip to content

Commit

Permalink
Update yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
building-u committed Jul 13, 2024
1 parent c672858 commit f97bd89
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,29 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Deploy to VPS
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_USER: ${{ secrets.SSH_USER }}
run: |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > private_key
chmod 600 private_key
ssh -i private_key -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF'
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14' # Ensure this matches the version you install on your VPS

- name: Install dependencies
run: npm install

- name: SSH and Stop API
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: |
cd /root/home/Building-u-feedback
git pull origin main
npm install
pm2 stop all || true
pm2 start index.js --name building-u-feedback-api --watch
pm2 save
pm2 startup -u ${{ secrets.SSH_USER }} --hp /home/${{ secrets.SSH_USER }}
EOF
rm private_key
deploy-frontend:
name: Deploy Frontend
Expand All @@ -48,7 +53,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
node-version: '20'

- name: Install dependencies
run: cd views && npm install
Expand Down

0 comments on commit f97bd89

Please sign in to comment.