Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions GitHub/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Deploy Project

on:
push:
branches: [main]

jobs:
deploy:
runs-on: ubuntu-latest
container:
image: node:20
steps:
- uses: actions/checkout@v3
with:
node-versions: 20
- run: npm ci
- run: npm run build
- name: Get SSH Key and set up permissions
run:
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
- name: Deploy using SCP
run: scp -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa -r ./dist/* ${{ secrets.SSH_USER }}@${{ secrets.SSH_Host }}:~/node-app
- name: Restart Server
run: ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa ${{ secrets.SSH_USER }}@${{ secrets.SSH_Host }} "cd ~/node-app && npm install && pm2 restart 0"


18 changes: 18 additions & 0 deletions GitHub/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Test Project

on:
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
image: node:20
steps:
- uses: actions/checkout@v3
with:
node-versions: 20
- run: npm ci
- run: npm test
- run: npm run build