Skip to content

Setup nginx from the configuration file #12

Setup nginx from the configuration file

Setup nginx from the configuration file #12

name: Setup Nginx from Configuration Files
on:
workflow_dispatch:
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Dotenv Action
uses: falti/dotenv-action@v1.1.4
with:
export-variables: true
keys-case: bypass
- name: Generate Nginx config
run: |
envsubst '\$GROUP_ID \$DOMAIN \$URL_PREFIX \$DEV_PORT_PREFIX \$STAG_PORT_PREFIX \$PROD_PORT_PREFIX \$DEV_BACKEND_PORT \$DEV_FRONTEND_PORT \$DEV_GATEWAY_PORT \$STAG_BACKEND_PORT \$STAG_FRONTEND_PORT \$STAG_GATEWAY_PORT \$PROD_BACKEND_PORT \$PROD_FRONTEND_PORT \$PROD_GATEWAY_PORT' < ./nginx_template.txt > temp_default.conf
- name: Copy Nginx config files
run: |
sudo cp temp_default.conf /etc/nginx/conf.d/default.conf
sudo cp nginx_securefit.conf /etc/nginx/conf.d/nginx_securefit.conf
- name: Show Nginx config files
run: |
cat /etc/nginx/conf.d/default.conf
cat /etc/nginx/conf.d/nginx_securefit.conf
- name: Test Nginx configuration
run: sudo nginx -t
- name: Reload Nginx
run: sudo systemctl reload nginx