From f79ff779251f7035bc05ec1d2e3bcad7999f60cb Mon Sep 17 00:00:00 2001 From: SennayT Date: Thu, 28 May 2026 13:01:52 +0300 Subject: [PATCH] add COMPOSE_PROJECT_NAME for each workflow --- .github/workflows/deploy-freight.yml | 23 +++++++++++++++-------- .github/workflows/deploy-passenger.yml | 23 +++++++++++++++-------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/.github/workflows/deploy-freight.yml b/.github/workflows/deploy-freight.yml index a09faf599..778ad4067 100644 --- a/.github/workflows/deploy-freight.yml +++ b/.github/workflows/deploy-freight.yml @@ -6,6 +6,7 @@ on: - main - develop - staging + - feat/improve-buid-pipeline paths: - "apps/edr-freight-api/**" - "apps/edr-freight-web/**" @@ -45,6 +46,12 @@ jobs: freight-portal \ freight-backoffice + - name: Set compose project name + run: | + set -euo pipefail + branch_slug=$(echo "${BRANCH}" | tr "[:upper:]" "[:lower:]" | sed -E "s/[^a-z0-9]+/-/g; s/^-+//; s/-+$//") + echo "COMPOSE_PROJECT_NAME=${PROJECT}-${branch_slug}" >> "${GITHUB_ENV}" + - name: Configure npm auth for Docker builds env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} @@ -53,18 +60,18 @@ jobs: - name: Build images run: | set -euo pipefail - docker compose build \ + docker compose --project-name "${COMPOSE_PROJECT_NAME}" build \ freight-api \ freight-portal \ freight-backoffice - - name: Deploy containers - run: | - set -euo pipefail - docker compose up -d \ - freight-api \ - freight-portal \ - freight-backoffice + # - name: Deploy containers + # run: | + # set -euo pipefail + # docker compose --project-name "${COMPOSE_PROJECT_NAME}" up -d \ + # freight-api \ + # freight-portal \ + # freight-backoffice - name: Remove npm credentials from workspace if: always() diff --git a/.github/workflows/deploy-passenger.yml b/.github/workflows/deploy-passenger.yml index ae4864fe8..c282fd9d5 100644 --- a/.github/workflows/deploy-passenger.yml +++ b/.github/workflows/deploy-passenger.yml @@ -6,6 +6,7 @@ on: - main - develop - staging + - feat/improve-buid-pipeline paths: - "apps/edr-passenger-api/**" - "apps/edr-passenger-web/**" @@ -45,6 +46,12 @@ jobs: passenger-portal \ passenger-backoffice + - name: Set compose project name + run: | + set -euo pipefail + branch_slug=$(echo "${BRANCH}" | tr "[:upper:]" "[:lower:]" | sed -E "s/[^a-z0-9]+/-/g; s/^-+//; s/-+$//") + echo "COMPOSE_PROJECT_NAME=${PROJECT}-${branch_slug}" >> "${GITHUB_ENV}" + - name: Configure npm auth for Docker builds env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} @@ -53,18 +60,18 @@ jobs: - name: Build images run: | set -euo pipefail - docker compose build \ + docker compose --project-name "${COMPOSE_PROJECT_NAME}" build \ passenger-api \ passenger-portal \ passenger-backoffice - - name: Deploy containers - run: | - set -euo pipefail - docker compose up -d \ - passenger-api \ - passenger-portal \ - passenger-backoffice + # - name: Deploy containers + # run: | + # set -euo pipefail + # docker compose --project-name "${COMPOSE_PROJECT_NAME}" up -d \ + # passenger-api \ + # passenger-portal \ + # passenger-backoffice - name: Remove npm credentials from workspace if: always()