Skip to content

fix make

fix make #21

Workflow file for this run

name: SCID 3 Bot Workflow
on:
push:
branches:
- master
- dev # закомментить перед выходом в прод
# pull_request:
# branches:
# - dev
jobs:
linter:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
- name: Test with flake8
run: python -m flake8 app/
build_and_push_to_docker_hub:
name: Push Docker image to DockerHub
runs-on: ubuntu-latest
needs: linter
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Docker Build
uses: docker/setup-buildx-action@v2
- name: Login to Docker
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to DockerHub
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: greenvibe/scid_bot_3:latest
deploy:
runs-on: ubuntu-latest
needs: build_and_push_to_docker_hub
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Copy docker-compose.yml via ssh
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
key: ${{ secrets.SSH_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
source: "docker-compose.yml"
target: "scid_bot"
- name: Executing remote ssh commands to deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
key: ${{ secrets.SSH_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
script: |
cd scid_bot
sudo docker compose -f docker-compose.yml pull
sudo docker compose -f docker-compose.yml down
sudo docker compose -f docker-compose.yml up -d
send_message:
runs-on: ubuntu-latest
needs: deploy
steps:
- name: Send message
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: Деплой успешно выполнен!