From 1f80c80475acfeffdcf3108fa5ead4ab1f248049 Mon Sep 17 00:00:00 2001 From: Weijun Lim Date: Sun, 16 Mar 2025 16:36:42 +0100 Subject: [PATCH] Create nginx_deploy.html --- .github/workflows/nginx_deploy.html | 49 +++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/nginx_deploy.html diff --git a/.github/workflows/nginx_deploy.html b/.github/workflows/nginx_deploy.html new file mode 100644 index 0000000..521067b --- /dev/null +++ b/.github/workflows/nginx_deploy.html @@ -0,0 +1,49 @@ +name: Setup Nginx from the configuration file + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: self-hosted # Ensure your runner is self-hosted + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Optionally set environment variables (skip if not needed) + - name: Set up environment variables + uses: falti/dotenv-action@v1.1.4 + with: + export-variables: true + keys-case: bypass + + - name: Check environment variables + run: env + + # Copy Nginx configuration to the server + - name: Copy Nginx configuration to server + run: | + sudo cp ./nginx_securefit.conf /etc/nginx/conf.d/nginx_securefit.conf + + # Test the Nginx configuration for errors + - name: Test Nginx Configuration + run: | + sudo nginx -t + + # Reload Nginx to apply the new configuration + - name: Reload Nginx + run: | + sudo systemctl reload nginx + + # Check if Nginx is running properly + - name: Check Nginx status + run: | + sudo systemctl status nginx + + # Optionally, display the deployed Nginx configuration for debugging + - name: Show deployed Nginx configuration + run: | + cat /etc/nginx/conf.d/nginx_securefit.conf