-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (40 loc) · 1.9 KB
/
main.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
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