Skip to content

Multi Environment Build #796

Multi Environment Build

Multi Environment Build #796

name: Multi Environment Build
on:
release:
types: [ 'released' ]
push:
branches: [ 'main', 'feature/**' ]
pull_request_review:
types: [submitted]
jobs:
setup_deployment:
name: Setup Deployment
runs-on: ubuntu-latest
outputs:
env_version: ${{ steps.set-env.outputs.env_version }}
microservices: ${{ steps.filter.outputs.changes }}
steps:
- name: Determine Build Environment
id: set-env
run: |
if ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/feature/') }}; then
echo "DEV environment"
echo "env_version=v10-dev" >> $GITHUB_OUTPUT
elif ${{ github.event_name == 'pull_request_review' && github.event.review.state == 'approved' && github.event.pull_request.base.ref == 'main' && startsWith(github.event.pull_request.head.ref, 'feature/') }}; then
echo "QA environment"
echo "env_version=v10-qa" >> $GITHUB_OUTPUT
elif ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}; then
echo "RC environment"
echo "env_version=v10-rc" >> $GITHUB_OUTPUT
elif ${{ github.event_name == 'release' }}; then
echo "RELEASE environment"
echo "env_version=v10" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
agent-manager: agent-manager/**
aws: aws/**
backend:
- 'backend/**'
- 'version.yml'
correlation: correlation/**
frontend: frontend/**
bitdefender: bitdefender/**
mutate: mutate/**
office365: office365/**
log-auth-proxy: log-auth-proxy/**
sophos: sophos/**
user-auditor: user-auditor/**
web-pdf: web-pdf/**
runner:
name: Deployment
needs: setup_deployment
if: ${{ needs.setup_deployment.outputs.microservices != '[]' && needs.setup_deployment.outputs.env_version != ''}}
strategy:
fail-fast: false
matrix:
service: ${{ fromJson(needs.setup_deployment.outputs.microservices) }}
uses: ./.github/workflows/used-runner.yml
with:
microservice: ${{ matrix.service }}
environment: ${{ needs.setup_deployment.outputs.env_version }}
secrets: inherit
runner_release:
name: Deployment for Release
needs: setup_deployment
if: ${{ needs.setup_deployment.outputs.env_version == 'v10' }}
strategy:
fail-fast: false
matrix:
service: ['agent-manager', 'aws', 'backend', 'correlation', 'frontend', 'bitdefender', 'mutate', 'office365', 'log-auth-proxy', 'sophos', 'user-auditor', 'web-pdf']
uses: ./.github/workflows/used-runner.yml
with:
microservice: ${{ matrix.service }}
environment: ${{ needs.setup_deployment.outputs.env_version }}
secrets: inherit