mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
move pipelines to one file
This commit is contained in:
78
.github/workflows/deploy-freight.yml
vendored
78
.github/workflows/deploy-freight.yml
vendored
@@ -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
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Deploy Passenger
|
name: Deploy Stacks
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -8,6 +8,8 @@ on:
|
|||||||
- staging
|
- staging
|
||||||
- feat/improve-buid-pipeline
|
- feat/improve-buid-pipeline
|
||||||
paths:
|
paths:
|
||||||
|
- "apps/edr-freight-api/**"
|
||||||
|
- "apps/edr-freight-web/**"
|
||||||
- "apps/edr-passenger-api/**"
|
- "apps/edr-passenger-api/**"
|
||||||
- "apps/edr-passenger-web/**"
|
- "apps/edr-passenger-web/**"
|
||||||
- "packages/**"
|
- "packages/**"
|
||||||
@@ -16,15 +18,68 @@ on:
|
|||||||
- "docker-compose.yaml"
|
- "docker-compose.yaml"
|
||||||
- "pnpm-lock.yaml"
|
- "pnpm-lock.yaml"
|
||||||
- "scripts/deploy/**"
|
- "scripts/deploy/**"
|
||||||
- ".github/workflows/deploy-passenger.yml"
|
- ".github/workflows/deploy.yml"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: deploy-passenger-${{ github.ref_name }}
|
group: deploy-${{ github.ref_name }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
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
|
name: Build and deploy passenger stack
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
env:
|
env:
|
||||||
@@ -14,7 +14,7 @@ set -euo pipefail
|
|||||||
DEPLOY_USER="${DEPLOY_USER:-tria}"
|
DEPLOY_USER="${DEPLOY_USER:-tria}"
|
||||||
BRANCH="${BRANCH:?BRANCH is required}"
|
BRANCH="${BRANCH:?BRANCH is required}"
|
||||||
BRANCH_SLUG="${BRANCH_SLUG:-$(echo "${BRANCH}" | tr "[:upper:]" "[:lower:]" | sed -E "s/[^a-z0-9]+/-/g; s/^-+//; s/-+$//")}"
|
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
|
if [[ ! -d "${ENV_ROOT}" ]]; then
|
||||||
echo "Environment directory not found: ${ENV_ROOT}" >&2
|
echo "Environment directory not found: ${ENV_ROOT}" >&2
|
||||||
|
|||||||
Reference in New Issue
Block a user