chore: run script with correct privileges
This commit is contained in:
@@ -67,4 +67,4 @@ jobs:
|
|||||||
key: ${{ secrets.SSH_KEY }}
|
key: ${{ secrets.SSH_KEY }}
|
||||||
script: |
|
script: |
|
||||||
chmod +x blog.stevanfreeborn.com/deploy.ps1
|
chmod +x blog.stevanfreeborn.com/deploy.ps1
|
||||||
./blog.stevanfreeborn.com/deploy.ps1 ${{ needs.build.outputs.version }}
|
sudo pwsh ./blog.stevanfreeborn.com/deploy.ps1 ${{ needs.build.outputs.version }}
|
||||||
+6
-6
@@ -1,5 +1,3 @@
|
|||||||
#!/bin/pwsh
|
|
||||||
|
|
||||||
$NGINX_CONFIG_PATH = "/etc/nginx/sites-available/blog.ddnsgeek.com"
|
$NGINX_CONFIG_PATH = "/etc/nginx/sites-available/blog.ddnsgeek.com"
|
||||||
|
|
||||||
function StartContainer {
|
function StartContainer {
|
||||||
@@ -108,6 +106,8 @@ if ($LASTEXITCODE -ne 0)
|
|||||||
# Checkif green container is running
|
# Checkif green container is running
|
||||||
$greenContainerId = docker ps --filter "name=blog.stevanfreeborn.com.green" --format "{{.ID}}"
|
$greenContainerId = docker ps --filter "name=blog.stevanfreeborn.com.green" --format "{{.ID}}"
|
||||||
|
|
||||||
|
Write-Host "Green container ID: $greenContainerId"
|
||||||
|
|
||||||
if ($null -eq $greenContainerId)
|
if ($null -eq $greenContainerId)
|
||||||
{
|
{
|
||||||
Write-Host "Green container is running. Starting blue container."
|
Write-Host "Green container is running. Starting blue container."
|
||||||
@@ -120,7 +120,7 @@ if ($null -eq $greenContainerId)
|
|||||||
|
|
||||||
Write-Host "Nginx configuration updated to point to blue container on port $blueContainerHostPort."
|
Write-Host "Nginx configuration updated to point to blue container on port $blueContainerHostPort."
|
||||||
|
|
||||||
sudo nginx -t
|
nginx -t
|
||||||
|
|
||||||
if ($LASTEXITCODE -ne 0)
|
if ($LASTEXITCODE -ne 0)
|
||||||
{
|
{
|
||||||
@@ -129,7 +129,7 @@ if ($null -eq $greenContainerId)
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
sudo nginx -s reload
|
nginx -s reload
|
||||||
|
|
||||||
if ($LASTEXITCODE -ne 0)
|
if ($LASTEXITCODE -ne 0)
|
||||||
{
|
{
|
||||||
@@ -185,7 +185,7 @@ else
|
|||||||
|
|
||||||
Write-Host "Nginx configuration updated to point to green container on port $greenContainerHostPort."
|
Write-Host "Nginx configuration updated to point to green container on port $greenContainerHostPort."
|
||||||
|
|
||||||
sudo nginx -t
|
nginx -t
|
||||||
|
|
||||||
if ($LASTEXITCODE -ne 0)
|
if ($LASTEXITCODE -ne 0)
|
||||||
{
|
{
|
||||||
@@ -194,7 +194,7 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
sudo nginx -s reload
|
nginx -s reload
|
||||||
|
|
||||||
if ($LASTEXITCODE -ne 0)
|
if ($LASTEXITCODE -ne 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user