Skip to content

Commit

Permalink
Update nginx_deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Weijun Lim authored and GitHub Enterprise committed Mar 17, 2025
1 parent ce6bfc8 commit 0f89558
Showing 1 changed file with 30 additions and 11 deletions.
41 changes: 30 additions & 11 deletions .github/workflows/nginx_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,49 @@
name: Deploy Nginx Configuration
name: Setup Nginx from the configuration file

on:
pull_request:
branches:
- main
paths:
- "nginx/nginx.conf" # Adjust the path to your nginx.conf file in the root directory

jobs:
deploy:
runs-on: self-hosted # Make sure your runner is self-hosted (or adjust this for GitHub-hosted runners)
runs-on: self-hosted # Ensure your runner is self-hosted

steps:
# Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v3

# Copy Nginx Configuration to the server's /etc/nginx directory
- name: Copy Nginx Configuration
# 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/nginx.conf /etc/nginx/conf.d/nginx_securefit.conf
# Test Nginx configuration to check for syntax errors
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

0 comments on commit 0f89558

Please sign in to comment.