From 682dc9a71535ec431b092c6d7301cffc806c21ae Mon Sep 17 00:00:00 2001 From: c-d-p Date: Thu, 1 May 2025 15:16:43 +0200 Subject: [PATCH] fixed broken deploy.yml --- .gitea/workflows/deploy.yml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index ec9cbe0..af8a093 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -218,7 +218,6 @@ jobs: PEPPER: ${{ secrets.PEPPER }} JWT_SECRET_KEY: ${{ secrets.JWT_SECRET_KEY }} GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} - DOCKER_REGISTRY_USERNAME: ${{ secrets.DOCKER_REGISTRY_USERNAME }} run: | #!/bin/bash -ex @@ -226,9 +225,6 @@ jobs: WORKSPACE_DIR="${{ gitea.workspace }}/backend" # Dir where deploy compose file lives COMPOSE_FILE="${WORKSPACE_DIR}/docker-compose.deploy.yml" PROJECT_NAME="maia" # Project name used by docker compose - BACKEND_IMAGE_TAG="${GITEA_SHA}" - FRONTEND_IMAGE_TAG="${GITEA_SHA}" # same tag for simplicity - echo "--- Start Deployment ---" echo "Using compose file: ${COMPOSE_FILE}" @@ -239,13 +235,13 @@ jobs: fi # --- Pull specific backend image version --- - echo "Pulling backend image ${BACKEND_IMAGE_TAG}..." - docker pull ghcr.io/${DOCKER_REGISTRY_USERNAME}/maia:${BACKEND_IMAGE_TAG} + echo "Pulling backend image ${{ gitea.sha }}..." + docker pull ghcr.io/${{ secrets.DOCKER_REGISTRY_USERNAME }}/maia:${{ gitea.sha }}} echo "Backend pull complete." # --- Pull specific frontend image version --- - echo "Pulling frontend image ${FRONTEND_IMAGE_TAG}..." - docker pull ghcr.io/${DOCKER_REGISTRY_USERNAME}/maia-frontend:${FRONTEND_IMAGE_TAG} + echo "Pulling frontend image ${{ gitea.sha }}..." + docker pull ghcr.io/${{ secrets.DOCKER_REGISTRY_USERNAME }}/maia-frontend:${{ gitea.sha }} echo "Frontend pull complete." # --- Pull other images defined in compose --- @@ -256,13 +252,13 @@ jobs: # --- Update Backend image tag in compose file --- echo "Updating Backend image tag in ${COMPOSE_FILE##*/}..." - sed -i "s|image: ghcr.io/${DOCKER_REGISTRY_USERNAME}/maia:.*|image: ghcr.io/${DOCKER_REGISTRY_USERNAME}/maia:${BACKEND_IMAGE_TAG}|g" "${COMPOSE_FILE##*/}" - grep "image: ghcr.io/${DOCKER_REGISTRY_USERNAME}/maia:" "${COMPOSE_FILE##*/}" || echo "Backend image line not found!" + sed -i "s|image: ghcr.io/${{ secrets.DOCKER_REGISTRY_USERNAME }}/maia:.*|image: ghcr.io/${{ secrets.DOCKER_REGISTRY_USERNAME }}/maia:${{ gitea.sha }}|g" "${COMPOSE_FILE##*/}" + grep "image: ghcr.io/${{ secrets.DOCKER_REGISTRY_USERNAME }}/maia:" "${COMPOSE_FILE##*/}" || echo "Backend image line not found!" # --- Update Frontend image tag in compose file --- echo "Updating Frontend image tag in ${COMPOSE_FILE##*/}..." - sed -i "s|image: ghcr.io/${DOCKER_REGISTRY_USERNAME}/maia-frontend:.*|image: ghcr.io/${DOCKER_REGISTRY_USERNAME}/maia-frontend:${FRONTEND_IMAGE_TAG}|g" "${COMPOSE_FILE##*/}" - grep "image: ghcr.io/${DOCKER_REGISTRY_USERNAME}/maia-frontend:" "${COMPOSE_FILE##*/}" || echo "Frontend image line not found!" + sed -i "s|image: ghcr.io/${{ secrets.DOCKER_REGISTRY_USERNAME }}/maia-frontend:.*|image: ghcr.io/${{ secrets.DOCKER_REGISTRY_USERNAME }}/maia-frontend:${{ gitea.sha }}|g" "${COMPOSE_FILE##*/}" + grep "image: ghcr.io/${{ secrets.DOCKER_REGISTRY_USERNAME }}/maia-frontend:" "${COMPOSE_FILE##*/}" || echo "Frontend image line not found!" # --- Restart services using updated compose file --- echo "Bringing compose stack down and up for project ${PROJECT_NAME}..."