Setup nginx from the configuration file #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 \$PORT_PREFIX \$DEV_POSTFIX \$STAG_POSTFIX \$PROD_POSTFIX \$BACKEND_POSTFIX \$FRONTEND_POSTFIX \$GATEWAY_POSTFIX' < ./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 |