Skip to content

Fix deployment script #72

Fix deployment script

Fix deployment script #72

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Connect to DigitalOcean Droplet
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
set -e
# Update the repository and install dependencies
cd ~
rm -rf ./pc-components
git clone https://github.com/Pansysk75/pc-components.git
# API server setup
cd ~/pc-components/api-server
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
export DATABASE_URI=${{ secrets.DATABASE_URI }}
# Start or reload API server using PM2
pm2 reload api-server || pm2 start run.py --name api-server --interpreter ./venv/bin/python3 --update-env
# Web app setup
cd ~/pc-components/web-app
npm install
# Start or reload web app using PM2
pm2 reload web-server || pm2 start server.js --name web-app --update-env
# Save PM2 process list
pm2 save