add COMPOSE_PROJECT_NAME for each workflow

This commit is contained in:
SennayT
2026-05-28 13:01:52 +03:00
parent 342ccb63de
commit f79ff77925
2 changed files with 30 additions and 16 deletions

View File

@@ -6,6 +6,7 @@ on:
- main - main
- develop - develop
- staging - staging
- feat/improve-buid-pipeline
paths: paths:
- "apps/edr-freight-api/**" - "apps/edr-freight-api/**"
- "apps/edr-freight-web/**" - "apps/edr-freight-web/**"
@@ -45,6 +46,12 @@ jobs:
freight-portal \ freight-portal \
freight-backoffice 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 - name: Configure npm auth for Docker builds
env: env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -53,18 +60,18 @@ jobs:
- name: Build images - name: Build images
run: | run: |
set -euo pipefail set -euo pipefail
docker compose build \ docker compose --project-name "${COMPOSE_PROJECT_NAME}" build \
freight-api \ freight-api \
freight-portal \ freight-portal \
freight-backoffice freight-backoffice
- name: Deploy containers # - name: Deploy containers
run: | # run: |
set -euo pipefail # set -euo pipefail
docker compose up -d \ # docker compose --project-name "${COMPOSE_PROJECT_NAME}" up -d \
freight-api \ # freight-api \
freight-portal \ # freight-portal \
freight-backoffice # freight-backoffice
- name: Remove npm credentials from workspace - name: Remove npm credentials from workspace
if: always() if: always()

View File

@@ -6,6 +6,7 @@ on:
- main - main
- develop - develop
- staging - staging
- feat/improve-buid-pipeline
paths: paths:
- "apps/edr-passenger-api/**" - "apps/edr-passenger-api/**"
- "apps/edr-passenger-web/**" - "apps/edr-passenger-web/**"
@@ -45,6 +46,12 @@ jobs:
passenger-portal \ passenger-portal \
passenger-backoffice 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 - name: Configure npm auth for Docker builds
env: env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -53,18 +60,18 @@ jobs:
- name: Build images - name: Build images
run: | run: |
set -euo pipefail set -euo pipefail
docker compose build \ docker compose --project-name "${COMPOSE_PROJECT_NAME}" build \
passenger-api \ passenger-api \
passenger-portal \ passenger-portal \
passenger-backoffice passenger-backoffice
- name: Deploy containers # - name: Deploy containers
run: | # run: |
set -euo pipefail # set -euo pipefail
docker compose up -d \ # docker compose --project-name "${COMPOSE_PROJECT_NAME}" up -d \
passenger-api \ # passenger-api \
passenger-portal \ # passenger-portal \
passenger-backoffice # passenger-backoffice
- name: Remove npm credentials from workspace - name: Remove npm credentials from workspace
if: always() if: always()