Skip to content

This commit enables automated deployment of the worker application ba… #2

This commit enables automated deployment of the worker application ba…

This commit enables automated deployment of the worker application ba… #2

Workflow file for this run

name: Deploy worker
on:
push:
branches: ["main", "dev"]
workflow_dispatch:
jobs:
deploy:
runs-on: ${{ github.ref == 'refs/heads/main' && 'ipca-prod' || 'ipca-test' }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up environment
run: |
# MYSQL
echo "DB_HOST"=${{ secrets.DB_HOST }} >> .env
echo "DB_PORT"=${{ secrets.DB_PORT }} >> .env
echo "DB_EXPOSE_PORT"= ${{ secrets.DB_EXPOSE_PORT }} >> .env
echo "DB_NAME"=${{ secrets.DB_NAME }} >> .env
echo "DB_USER"=${{ secrets.DB_USER }} >> .env
echo "DB_PASSWORD"=${{ secrets.DB_PASSWORD }} >> .env
echo "DB_ROOT_PASSWORD"=${{ secrets.DB_ROOT_PASSWORD }} >> .env
echo "DB_DRIVER"=${{ secrets.DB_DRIVER }} >> .env
# REDIS
echo "REDIS_HOST"=${{ secrets.REDIS_HOST }} >> .env
echo "REDIS_PORT"=${{ secrets.REDIS_PORT }} >> .env
echo "REDIS_EXPOSE_PORT"=${{ secrets.REDIS_EXPOSE_PORT }} >> .env
echo "REDIS_USER"=${{ secrets.REDIS_USER }} >> .env
echo "REDIS_PASSWORD"=${{ secrets.REDIS_PASSWORD }} >> .env
# RABBITMQ
echo "RABBITMQ_HOST"=${{ secrets.RABBITMQ_HOST }} >> .env
echo "RABBITMQ_PORT"=${{ secrets.RABBITMQ_PORT }} >> .env
echo "RABBITMQ_USER"=${{ secrets.RABBITMQ_USER }} >> .env
echo "RABBITMQ_PASSWORD"=${{ secrets.RABBITMQ_PASSWORD }} >> .env
echo "RABBITMQ_QUEUENAME"=${{ secrets.RABBITMQ_QUEUENAME }} >> .env
- name: Deploy Web Application
if: github.ref == 'refs/heads/master'
run: docker compose -f docker-compose.prod.yml up -d --build --force-recreate && docker system prune -f
- name: Deploy Web Application (Dev)
if: github.ref == 'refs/heads/dev'
run: docker compose -f docker-compose.dev.yml up -d --build --force-recreate && docker system prune -f