Skip to content

Commit

Permalink
This commit enables automated deployment of the worker application ba…
Browse files Browse the repository at this point in the history
…sed on the branch being pushed to.
  • Loading branch information
fair1478 committed Sep 24, 2024
1 parent 2b6c2ac commit 0d4e7e2
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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

0 comments on commit 0d4e7e2

Please sign in to comment.