-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (82 loc) · 3.49 KB
/
pr_closed_test.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: PR_CLOSED DEPLOY AND TG ALERT
on:
pull_request:
types: [closed]
branches:
- test
jobs:
build_and_push_to_docker_hub:
name: Push Docker image to Docker Hub
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
push: true
tags: lapkipomoshi/help_paw_f:test
deploy:
runs-on: ubuntu-latest
needs: build_and_push_to_docker_hub
steps:
- name: executing remote ssh commands to deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.TEST_HOST }}
username: ${{ secrets.USER }}
password: ${{ secrets.PASSWORD }}
script: |
cd ~/test
sudo docker-compose stop
rm .env
touch .env
echo DB_ENGINE=${{ secrets.DB_ENGINE }} >> .env
echo DB_NAME=${{ secrets.DB_NAME }} >> .env
echo POSTGRES_USER=${{ secrets.POSTGRES_USER }} >> .env
echo POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }} >> .env
echo DB_HOST=${{ secrets.DB_HOST }} >> .env
echo DB_PORT=${{ secrets.DB_PORT }} >> .env
echo D_KEY=${{ secrets.D_KEY }} >> .env
echo LOCAL=${{ secrets.LOCAL }} >> .env
echo BOT=${{ secrets.BOT }} >> .env
echo ALERT_CHANNEL=${{ secrets.ALERT_CHANNEL }} >> .env
echo EMAIL_HOST=${{ secrets.EMAIL_HOST }} >> .env
echo EMAIL_PORT=${{ secrets.EMAIL_PORT }} >> .env
echo EMAIL_HOST_USER=${{ secrets.EMAIL_HOST_USER }} >> .env
echo EMAIL_HOST_PASSWORD=${{ secrets.EMAIL_HOST_PASSWORD }} >> .env
echo EMAIL_USE_SSL=${{ secrets.EMAIL_USE_SSL }} >> .env
echo EMAIL_USE_TLS=${{ secrets.EMAIL_USE_TLS }} >> .env
echo DEBUG=${{ secrets.TEST_DEBUG }} >> .env
echo EMAIL_BACKEND_TYPE=${{ secrets.EMAIL_BACKEND_TYPE }} >> .env
echo REACT_APP_SERVER_TYPE=${{ secrets.REACT_APP_SERVER_TYPE_TEST }} >> .env
echo YOOKASSA_CLIENT_ID=${{ secrets.YOOKASSA_CLIENT_ID }} >> .env
echo YOOKASSA_CLIENT_SECRET=${{ secrets.YOOKASSA_CLIENT_SECRET }} >> .env
sudo docker-compose pull
sudo docker-compose up -d
send_message:
runs-on: ubuntu-latest
needs: deploy
steps:
- name: send message
if: github.event.pull_request.merged == true
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.ALERT_CHANNEL }}
token: ${{ secrets.BOT }}
message: FRONTEND - ${{ github.event_name }} ветки ${{ github.head_ref }} успешно смержен в ${{ github.base_ref }}, TEST обновлен и перезапущен
- name: send message merged
if: github.event.pull_request.merged == false
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.ALERT_CHANNEL }}
token: ${{ secrets.BOT }}
message: FRONTEND - ${{ github.event_name }} ветки ${{ github.head_ref }} в ${{ github.base_ref }} закрыт без мержа, деплой не производился.