рефакторинг: переделал страницу питомцев #48
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: 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 }} закрыт без мержа, деплой не производился. |