Skip to content

Merge branch 'main' into integration #610

Merge branch 'main' into integration

Merge branch 'main' into integration #610

Workflow file for this run

name: deploy on VPS
on:
push:
branches:
- main
- integration
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Extract branch name
shell: bash
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT
id: extract_branch
- uses: actions/checkout@v3
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%H:%M_%d-%m-%Y')"
- name: Push to server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_IP }}
port: ${{ secrets.SERVER_PORT }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
script: |
set -e
cd ${{ secrets.PROJECT_PATH }}/${{ steps.extract_branch.outputs.branch }}
git fetch
git checkout ${{ steps.extract_branch.outputs.branch }}
git pull
cd ${{ secrets.PROJECT_PATH }}/${{ steps.extract_branch.outputs.branch }}
echo > logs/gunicorn_access.log
echo > logs/gunicorn_error.log
echo "${{ steps.date.outputs.date }} -> ${{ github.actor }}" >> deploy.log
${{ secrets.POETRY_BIN }} install --sync
${{ secrets.POETRY_BIN }} run alembic upgrade head
sudo systemctl restart Backend.${{ steps.extract_branch.outputs.branch }}
systemctl status Backend.${{ steps.extract_branch.outputs.branch }}.service