move pipelines to one file

This commit is contained in:
SennayT
2026-05-28 13:33:09 +03:00
parent d462ddaf29
commit 2a93de138f
3 changed files with 60 additions and 83 deletions

View File

@@ -1,78 +0,0 @@
name: Deploy Freight
on:
push:
branches:
- main
- develop
- staging
- feat/improve-buid-pipeline
paths:
- "apps/edr-freight-api/**"
- "apps/edr-freight-web/**"
- "packages/**"
- "infrastructure/docker/Dockerfile.web"
- "infrastructure/nginx/**"
- "docker-compose.yaml"
- "pnpm-lock.yaml"
- "scripts/deploy/**"
- ".github/workflows/deploy-freight.yml"
workflow_dispatch:
concurrency:
group: deploy-freight-${{ github.ref_name }}
cancel-in-progress: true
jobs:
deploy:
name: Build and deploy freight stack
runs-on: self-hosted
env:
PROJECT: edr-freight
BRANCH: ${{ github.ref_name }}
DEPLOY_USER: user
BUILD_ENV_FILE: freight-web.build.env
DOCKER_BUILDKIT: "1"
COMPOSE_DOCKER_CLI_BUILD: "1"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Sync environment from server
run: |
chmod +x scripts/deploy/*.sh
./scripts/deploy/sync-env-from-server.sh \
freight-api \
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 }}
run: ./scripts/deploy/create-npmrc.sh
- name: Build images
run: |
set -euo pipefail
docker compose --project-name "${COMPOSE_PROJECT_NAME}" build \
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()
run: rm -f .npmrc .npmrc_temp

View File

@@ -1,4 +1,4 @@
name: Deploy Passenger
name: Deploy Stacks
on:
push:
@@ -8,6 +8,8 @@ on:
- staging
- feat/improve-buid-pipeline
paths:
- "apps/edr-freight-api/**"
- "apps/edr-freight-web/**"
- "apps/edr-passenger-api/**"
- "apps/edr-passenger-web/**"
- "packages/**"
@@ -16,15 +18,68 @@ on:
- "docker-compose.yaml"
- "pnpm-lock.yaml"
- "scripts/deploy/**"
- ".github/workflows/deploy-passenger.yml"
- ".github/workflows/deploy.yml"
workflow_dispatch:
concurrency:
group: deploy-passenger-${{ github.ref_name }}
group: deploy-${{ github.ref_name }}
cancel-in-progress: true
jobs:
deploy:
deploy-freight:
name: Build and deploy freight stack
runs-on: self-hosted
env:
PROJECT: edr-freight
BRANCH: ${{ github.ref_name }}
DEPLOY_USER: user
BUILD_ENV_FILE: freight-web.build.env
DOCKER_BUILDKIT: "1"
COMPOSE_DOCKER_CLI_BUILD: "1"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Sync environment from server
run: |
chmod +x scripts/deploy/*.sh
./scripts/deploy/sync-env-from-server.sh \
freight-api \
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 }}
run: ./scripts/deploy/create-npmrc.sh
- name: Build images
run: |
set -euo pipefail
docker compose --project-name "${COMPOSE_PROJECT_NAME}" build \
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()
run: rm -f .npmrc .npmrc_temp
deploy-passenger:
name: Build and deploy passenger stack
runs-on: self-hosted
env:

View File

@@ -14,7 +14,7 @@ set -euo pipefail
DEPLOY_USER="${DEPLOY_USER:-tria}"
BRANCH="${BRANCH:?BRANCH is required}"
BRANCH_SLUG="${BRANCH_SLUG:-$(echo "${BRANCH}" | tr "[:upper:]" "[:lower:]" | sed -E "s/[^a-z0-9]+/-/g; s/^-+//; s/-+$//")}"
ENV_ROOT="${ENV_ROOT:-/home/${DEPLOY_USER}/environment/edr/${PROJECT:?PROJECT is required}/${BRANCH_SLUG}}"
ENV_ROOT="${ENV_ROOT:-/home/${DEPLOY_USER}/environment/edr/${BRANCH_SLUG}/${PROJECT:?PROJECT is required}}"
if [[ ! -d "${ENV_ROOT}" ]]; then
echo "Environment directory not found: ${ENV_ROOT}" >&2