test: powershell ssh deploy
Some checks failed
Deploy to Production / deploy (push) Failing after 3s
Some checks failed
Deploy to Production / deploy (push) Failing after 3s
This commit is contained in:
33
.github/workflows/deploy.yml
vendored
33
.github/workflows/deploy.yml
vendored
@@ -15,9 +15,32 @@ jobs:
|
|||||||
username: ${{ secrets.REMOTE_USER }}
|
username: ${{ secrets.REMOTE_USER }}
|
||||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
passphrase: ${{ secrets.SSH_PASSPHRASE }}
|
passphrase: ${{ secrets.SSH_PASSPHRASE }}
|
||||||
|
script_shell: pwsh
|
||||||
script: |
|
script: |
|
||||||
powershell -Command "if (Test-Path 'C:\projects\digital-resume-FE') { Set-Location C:\projects\digital-resume-FE; git pull origin main } else { New-Item -ItemType Directory -Path C:\projects -Force; Set-Location C:\projects; git clone https://gitea.sashabayda.ca/Bayda77/digital-resume-FE.git; Set-Location digital-resume-FE }"
|
# Navigate to project directory or clone if it doesn't exist
|
||||||
powershell -Command "$container = docker ps -a -q -f name=resume-frontend; if ($container) { docker stop resume-frontend; Start-Sleep -Seconds 2; docker rm resume-frontend }"
|
if (Test-Path "C:\projects\digital-resume-FE") {
|
||||||
powershell -Command "Set-Location C:\projects\digital-resume-FE; docker build -t resume-frontend:latest ."
|
Set-Location C:\projects\digital-resume-FE
|
||||||
powershell -Command "docker run -d --name resume-frontend --restart unless-stopped -p 3001:80 resume-frontend:latest"
|
git pull origin main
|
||||||
powershell -Command "docker image prune -f"
|
} else {
|
||||||
|
New-Item -ItemType Directory -Path C:\projects -Force
|
||||||
|
Set-Location C:\projects
|
||||||
|
git clone https://gitea.sashabayda.ca/Bayda77/digital-resume-FE.git
|
||||||
|
Set-Location digital-resume-FE
|
||||||
|
}
|
||||||
|
|
||||||
|
# Stop and remove existing container if it exists
|
||||||
|
$container = docker ps -a -q -f name=resume-frontend
|
||||||
|
if ($container) {
|
||||||
|
docker stop resume-frontend
|
||||||
|
Start-Sleep -Seconds 2
|
||||||
|
docker rm resume-frontend
|
||||||
|
}
|
||||||
|
|
||||||
|
# Build the Docker image
|
||||||
|
docker build -t resume-frontend:latest .
|
||||||
|
|
||||||
|
# Run new container
|
||||||
|
docker run -d --name resume-frontend --restart unless-stopped -p 3000:80 resume-frontend:latest
|
||||||
|
|
||||||
|
# Cleanup unused images
|
||||||
|
docker image prune -f
|
||||||
|
|||||||
Reference in New Issue
Block a user