From d876739884f22aae4291f8ea8db4eebd9a1b36e1 Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Sun, 16 Apr 2023 15:07:17 -0400 Subject: [PATCH 1/2] check for nginx conf validity --- .github/workflows/check_samples.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/check_samples.yml b/.github/workflows/check_samples.yml index 31da960..40007c8 100644 --- a/.github/workflows/check_samples.yml +++ b/.github/workflows/check_samples.yml @@ -58,3 +58,24 @@ jobs: done exit 1 fi + + - name: Check Nginx Conf Validity + run: | + curl -fsL "https://raw.githubusercontent.com/linuxserver/docker-swag/master/root/defaults/nginx/proxy.conf.sample" -o proxy.conf + docker run -d --rm --name nginx -v "${WORKSPACE}:/testconfs:ro" ghcr.io/linuxserver/nginx + sleep 5 + docker exec nginx bash -c "\ + mkdir -p /config/nginx/proxy-confs && \ + cp /testconfs/*.conf.sample /config/nginx/proxy-confs/ && \ + cp /testconfs/proxy.conf /config/nginx/ && \ + rm -rf /config/nginx/proxy-confs/{_template.sub*,heimdall.subf*,boinc.subf*,organizr.subf*,wordpress.subf*} && \ + echo 'include /config/nginx/proxy-confs/*.subdomain.conf.sample;' >> /config/nginx/site-confs/default.conf && \ + sed -i -r 's|(root \\\$root;)|\1\ninclude /config/nginx/proxy-confs/*.subfolder.conf.sample;|' /config/nginx/site-confs/default.conf" + VALIDITY=$(docker exec nginx nginx -t 2>&1) || : + echo "${VALIDITY}" + echo "${VALIDITY}" >> $GITHUB_STEP_SUMMARY + if ! docker exec nginx nginx -t >/dev/null 2>&1; then + docker stop nginx + exit 1 + fi + docker stop nginx From 8b7a052003eb14125dd9e21c4fe98ece391fbb15 Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Sun, 16 Apr 2023 15:21:16 -0400 Subject: [PATCH 2/2] fix typo --- .github/workflows/check_samples.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_samples.yml b/.github/workflows/check_samples.yml index 40007c8..d9e2efb 100644 --- a/.github/workflows/check_samples.yml +++ b/.github/workflows/check_samples.yml @@ -62,7 +62,7 @@ jobs: - name: Check Nginx Conf Validity run: | curl -fsL "https://raw.githubusercontent.com/linuxserver/docker-swag/master/root/defaults/nginx/proxy.conf.sample" -o proxy.conf - docker run -d --rm --name nginx -v "${WORKSPACE}:/testconfs:ro" ghcr.io/linuxserver/nginx + docker run -d --rm --name nginx -v "${GITHUB_WORKSPACE}:/testconfs:ro" ghcr.io/linuxserver/nginx sleep 5 docker exec nginx bash -c "\ mkdir -p /config/nginx/proxy-confs && \