Skip to content

Deploy nginx configuration to TDT4242 server #5

Deploy nginx configuration to TDT4242 server

Deploy nginx configuration to TDT4242 server #5

name: Deploy nginx configuration to TDT4242 server
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy-nginx:
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Setting up env variables
- name: Env variables
uses: falti/dotenv-action@v1.1.4
with:
export-variables: true
keys-case: bypass
# Test the nginx configuration
- name: Test nginx configuration
run: |
sudo nginx -t
# Copying nginx configuration file to the server
- name: Deploy nginx configuration file
run: |
sudo cp ./nginx/nginx.conf /etc/nginx/nginx.conf # Main config
sudo cp ./nginx/nginx.conf /etc/nginx/conf.d/nginx.conf # Server block (if needed)
sudo chown root:root /etc/nginx/nginx.conf
sudo chmod 644 /etc/nginx/nginx.conf
# Restarting nginx service
- name: Restart nginx service
run: |
sudo systemctl reload nginx
- name: Show deployed configuration
run: |
cat /etc/nginx/conf.d/nginx.conf