Setup nginx from the configuration file #9
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 File | |
| 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 to correct place | |
| run: sudo cp temp_default.conf /etc/nginx/conf.d/default.conf | |
| - name: Show Nginx config | |
| run: cat /etc/nginx/conf.d/default.conf | |
| - name: Reload Nginx | |
| run: sudo systemctl reload nginx |