mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 12:41:04 +00:00
72 lines
1.7 KiB
YAML
72 lines
1.7 KiB
YAML
name: Deploy Freight
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- develop
|
|
- staging
|
|
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: 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 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: Remove npm credentials from workspace
|
|
if: always()
|
|
run: rm -f .npmrc .npmrc_temp
|