Skip to content

add systemd service start command to setup script #8

add systemd service start command to setup script

add systemd service start command to setup script #8

Workflow file for this run

name: Deploy
on: [push]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy via SSH
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
key: ${{ secrets.PRIVATE_KEY }}
port: ${{ secrets.PORT }}
script: |
REPO_NAME="${{ secrets.REPO_NAME }}"
USERNAME="${{ secrets.USERNAME }}"
REPO_URL="git@github.com:$USERNAME/$REPO_NAME.git"
if [ ! -d "$REPO_NAME" ]; then
git clone "$REPO_URL" "$REPO_NAME"
fi
cd "$REPO_NAME"
if [ ! -d "venv_$REPO_NAME" ]; then
python3 -m venv "venv_$REPO_NAME"
fi
#if [ -f "$REPO_NAME.pid" ]; then
# kill -9 $(cat "$REPO_NAME.pid") || echo "No process found"
# rm "$REPO_NAME.pid"
#fi
git pull origin main
source "venv_$REPO_NAME/bin/activate"
pip install --upgrade pip
pip install -r requirements.txt
#nohup python main.py > output.log 2>&1 & echo $! > "$REPO_NAME.pid"