-
Notifications
You must be signed in to change notification settings - Fork 4
71 lines (60 loc) · 1.99 KB
/
main.yml
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: CI/CD
on: push
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install requirements
run: pip install -r requirements.txt
- name: Lint Ruff
run: ruff check .
- name: Lint Flake8
run: flake8 .
build:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- name: Copy repository contents via scp
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
port: ${{ secrets.PORT }}
key: ${{ secrets.SSHKEY }}
source: "."
target: "/home/ubuntu/Hamster-code-generator"
- name: Executing remote command
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
port: ${{ secrets.PORT }}
key: ${{ secrets.SSHKEY }}
script: |
cd /home/ubuntu/Hamster-code-generator
source .venv/bin/activate
pip install -r requirements.txt
ps aux | grep "python3 main.py" | grep -v grep | awk '{print $2}' | xargs -r kill -9
docker-compose stop
docker-compose up -d postgres backup redis
sleep 10
alembic upgrade head || { echo "Alembic migration failed"; exit 1; }
sudo systemctl restart telegram_bot.service
sudo systemctl restart keys_farm.service
create-release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: v1.7.0
name: "Release v1.7.0"
body: |
Added Redis, Ruff, new game 'Infected Frontier' | 🏖️
token: ${{ secrets.GITHUB_TOKEN }}