diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d50f24c..2fce001 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -15,9 +15,20 @@ jobs: username: ${{ secrets.REMOTE_USER }} key: ${{ secrets.SSH_PRIVATE_KEY }} passphrase: ${{ secrets.SSH_PASSPHRASE }} + script_stop: true 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 }" - powershell -Command "docker stop resume-frontend 2>$null; docker rm resume-frontend 2>$null; exit 0" - powershell -Command "Set-Location C:\projects\digital-resume-FE; docker build -t resume-frontend:latest ." - powershell -Command "docker run -d --name resume-frontend --restart unless-stopped -p 3000:80 resume-frontend:latest" - powershell -Command "docker image prune -f" + echo "=== Starting deployment ===" + echo "=== Step 1: Clone/Update repo ===" + cd C:\projects\digital-resume-FE 2>nul && git pull origin main || (mkdir C:\projects 2>nul & cd C:\projects & git clone https://gitea.sashabayda.ca/Bayda77/digital-resume-FE.git) + echo "=== Step 2: Stop existing container ===" + docker stop resume-frontend 2>nul + docker rm resume-frontend 2>nul + echo "=== Step 3: Build Docker image ===" + cd C:\projects\digital-resume-FE + docker build -t resume-frontend:latest . + echo "=== Step 4: Run container ===" + docker run -d --name resume-frontend --restart unless-stopped -p 3000:80 resume-frontend:latest + echo "=== Step 5: Cleanup ===" + docker image prune -f + echo "=== Step 6: Verify ===" + docker ps -a --filter name=resume-frontend