-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (48 loc) · 1.36 KB
/
python-app.yml
File metadata and controls
54 lines (48 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: DjangoStickersBot
on:
push:
branches: ["main", "dev"]
pull_request:
branches: ["main", "dev"]
permissions:
contents: read
jobs:
black-test:
runs-on: ubuntu-latest
container: python:3.12
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: pip install black
- name: Check code formatting with black
run: black ./django_stickers_bot/ --check --verbose --diff
flake8-test:
runs-on: ubuntu-latest
container: python:3.12
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: pip install -r requirements/test.txt
- name: Check code formatting with flake8
run: flake8 ./django_stickers_bot/
prod-deploy:
if: github.ref == 'refs/heads/main'
needs: [black-test, flake8-test]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy to server
uses: appleboy/ssh-action@master
with:
command_timeout: 200m
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_SSH_KEY }}
script: |
cd ~/django_stickers_bot
docker compose down
git reset --hard origin/main
git pull origin main
docker compose up --build -d
docker system prune -f --volumes