-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Weijun Lim
authored and
GitHub Enterprise
committed
Mar 16, 2025
1 parent
33a3e60
commit 1f80c80
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |