mirror of
https://github.com/FoggedLens/deflock.git
synced 2026-02-12 15:02:45 +00:00
48 lines
1.2 KiB
YAML
48 lines
1.2 KiB
YAML
name: Deploy DeFlock Backend
|
|
|
|
on:
|
|
push:
|
|
branches: [static-site]
|
|
# TODO: change to master after testing
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: backend
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Build TypeScript
|
|
run: npm run build
|
|
|
|
- name: Deploy to VPS
|
|
uses: appleboy/scp-action@v0.1.7
|
|
with:
|
|
host: ${{ secrets.VPS_HOST }}
|
|
username: ${{ secrets.VPS_USERNAME }}
|
|
key: ${{ secrets.VPS_SSH_KEY }}
|
|
source: "backend/dist/*"
|
|
target: "/home/nullplate/deflock/backend/dist"
|
|
strip_components: 2
|
|
rm: true
|
|
|
|
- name: Restart application
|
|
uses: appleboy/ssh-action@v1
|
|
with:
|
|
host: ${{ secrets.VPS_HOST }}
|
|
username: ${{ secrets.VPS_USERNAME }}
|
|
key: ${{ secrets.VPS_SSH_KEY }}
|
|
script: |
|
|
pm2 reload df-backend || pm2 start /home/nullplate/deflock/backend/dist/server.js --name df-backend
|