-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c672858
commit f97bd89
Showing
1 changed file
with
17 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 | ||
|