Skip to content

feat: implemetned env variable from secrets #9

feat: implemetned env variable from secrets

feat: implemetned env variable from secrets #9

Workflow file for this run

name: PR_CLOSED DEPLOY AND TG ALERT
on:
pull_request:
types: [closed]
branches:
- main
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
build-args: |

Check failure on line 20 in .github/workflows/pr_closed.yml

View workflow run for this annotation

GitHub Actions / PR_CLOSED DEPLOY AND TG ALERT

Invalid workflow file

The workflow is not valid. .github/workflows/pr_closed.yml (Line: 20, Col: 9): Unexpected value 'build-args'
SERVER_ENV=${{ secrets.REACT_APP_SERVER_TYPE_PROD }}
- 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:latest
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.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.DEBUG }} >> .env
echo EMAIL_BACKEND_TYPE=${{ secrets.EMAIL_BACKEND_TYPE }} >> .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 }}, LAPKIPOMOSHI.RU обновлен и перезапущен
- 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 }} закрыт без мержа, деплой не производился.