autodeploy test #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ | |
deploy: | |
runs-on: ubuntu-latest | |
needs: linter | |
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: "scid3" | |
- 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 scid3 | |
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: Деплой успешно выполнен! |