From 64170db4448e19bae583b2043dc272d17d4a0bdd Mon Sep 17 00:00:00 2001 From: Bayda77 Date: Wed, 7 Jan 2026 16:31:27 -0600 Subject: [PATCH] Squashed Deploy Configuration Test Env --- .github/workflows/deploy.yml | 62 ++---------------------------------- 1 file changed, 3 insertions(+), 59 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2420e15..143dd45 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,72 +4,16 @@ on: push: branches: [ "main" ] -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - jobs: - build-and-push: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=raw,value=latest - type=sha - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - deploy: runs-on: ubuntu-latest - needs: build-and-push steps: - - name: Deploy to Remote Server + - name: Deploy Application uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.REMOTE_HOST }} username: ${{ secrets.REMOTE_USER }} key: ${{ secrets.SSH_PRIVATE_KEY }} + passphrase: ${{ secrets.SSH_PASSPHRASE }} script: | - # Login to registry - echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - # Pull new image - docker pull ghcr.io/${{ env.IMAGE_NAME }}:latest - - # Stop and remove existing container - docker stop resume-frontend || true - docker rm resume-frontend || true - - # Run new container - docker run -d \ - --name resume-frontend \ - --restart unless-stopped \ - -p 80:80 \ - ghcr.io/${{ env.IMAGE_NAME }}:latest - - # Cleanup unused images - docker image prune -f + powershell -ExecutionPolicy Bypass -Command "Write-Host '=== Starting deployment ==='; 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 }; Write-Host '=== Stopping container ==='; docker stop resume-frontend; docker rm resume-frontend; Write-Host '=== Building image ==='; Set-Location 'C:\projects\digital-resume-FE'; docker build -t resume-frontend:latest .; Write-Host '=== Running container ==='; docker run -d --name resume-frontend --restart unless-stopped -p 3001:80 resume-frontend:latest; Write-Host '=== Verifying ==='; docker ps -a --filter name=resume-frontend"