Skip to content

πŸ—οΈ Build VENLY-8044 #109

πŸ—οΈ Build VENLY-8044

πŸ—οΈ Build VENLY-8044 #109

Workflow file for this run

name: πŸ—οΈ Build
on:
push:
paths-ignore:
- .github/**
pull_request:
workflow_dispatch:
merge_group:
create:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
env:
AWS_REGION: "eu-west-1"
CLUSTER_NAME_PREFIX: demo-projects
permissions:
actions: read
checks: write
contents: write
deployments: read
id-token: write
issues: read
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: read
run-name: πŸ—οΈ Build ${{ github.ref_name }}
jobs:
# =====================================================
# Job: Build
# =====================================================
build:
runs-on: ubuntu-latest
outputs:
sha_tag: ${{ steps.app_info.outputs.sha_tag }}
version_tag: ${{ steps.get_version.outputs.version }}
branch_tag: ${{ steps.app_info.outputs.branch_tag }}
steps:
- name: βœ… Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.VENLY_GITHUB_ACTIONS_TOKEN }}
- name: ℹ️ App Info
id: app_info
uses: ./.github/actions/app_info
with:
branch: ${{ github.ref }}
- name: πŸ” Get Version
id: get_version
uses: ./.github/actions/get_version
- name: πŸ“„ Show Build Information
run: |
echo "Sha Tag: ${{ steps.app_info.outputs.sha_tag }}"
echo "Version Tag: ${{ steps.get_version.outputs.version }}"
echo "Branch Tag: ${{ steps.app_info.outputs.branch_tag }}"
# =====================================================
# Job: Build Docker
# =====================================================
docker:
if: ${{ success() && github.event_name != 'pull_request' && contains(fromJSON('["main", "master", "develop"]'), github.ref_name) || startsWith(github.ref_name, 'release-') || startsWith(github.ref_name, 'hotfix-') || startsWith(github.ref_name, 'VENLY-7920') }}
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
include:
- ecr: venly-react-demo-arm-eu-west-1
docker_context: "connect-sdk"
steps:
- name: βœ… Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.VENLY_GITHUB_ACTIONS_TOKEN }}
- name: 🐳 Build and Push Docker Image
id: build-deploy-docker
uses: ./.github/actions/build_docker
with:
aws_role: ${{ secrets.RESOURCES_DEPLOY_ROLE }}
branch_tag: ${{ github.ref_name }}
build_args: |
VERSION=${{ needs.build.outputs.version_tag }}
[email protected]:${{ github.repository }}.git
DD_GIT_COMMIT_SHA=${{ github.sha }}
VITE_CLIENT_ID=ReactDemo
VITE_ENV=${{ startsWith(github.ref_name, 'release-') && 'staging' || (github.ref_name == 'main' && 'prd' || 'qa') }}
docker_context: ${{ matrix.docker_context }}
ecr_repo: ${{ matrix.ecr }}
platforms: linux/arm64
push_image: true
sha_tag: ${{ needs.build.outputs.sha_tag }}
version_tag: ${{ startsWith(github.ref_name, 'release-') && 'staging' || (github.ref_name == 'main' && 'prd' || 'qa') }}
# =====================================================
# Job: Deploy QA
# =====================================================
deploy-qa:
needs:
- build
- docker
runs-on: ubuntu-latest
if: github.ref_name == 'develop'
strategy:
matrix:
include:
- service_name: react-demo-qa-service
ecr: venly-react-demo-arm-eu-west-1
environment: "qa"
steps:
- name: βœ… Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: πŸš€ Deploy Application
uses: ./.github/actions/ecs_deploy
with:
aws_region: ${{ env.AWS_REGION }}
aws_role: ${{ secrets.NONPRD_DEPLOY_ROLE }}
aws_ecr_role: ${{ secrets.RESOURCES_DEPLOY_ROLE }}
cluster_name: "${{ env.CLUSTER_NAME_PREFIX }}-cluster"
ecr_repo: ${{ matrix.ecr }}
environment: ${{ matrix.environment }}
service_name: ${{ matrix.service_name }}
slack_webhook: ${{ secrets.SLACK_APPROVALS_WEBHOOK }}
tag_to_deploy: ${{ github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
# =====================================================
# Job: Deploy Release to Staging
# =====================================================
deploy-release-to-staging:
needs:
- build
- docker
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/heads/release-')
strategy:
matrix:
include:
- service_name: react-demo-staging-service
ecr: venly-react-demo-arm-eu-west-1
environment: "staging"
steps:
- name: βœ… Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: πŸš€ Deploy Application
uses: ./.github/actions/ecs_deploy
with:
aws_region: ${{ env.AWS_REGION }}
aws_role: ${{ secrets.NONPRD_DEPLOY_ROLE }}
aws_ecr_role: ${{ secrets.RESOURCES_DEPLOY_ROLE }}
cluster_name: ${{ env.CLUSTER_NAME_PREFIX }}-cluster
ecr_repo: ${{ matrix.ecr }}
environment: ${{ matrix.environment }}
service_name: ${{ matrix.service_name }}
slack_webhook: ${{ secrets.SLACK_APPROVALS_WEBHOOK }}
tag_to_deploy: ${{ github.ref_name }}
token: ${{ secrets.GITHUB_TOKEN }}
# =====================================================
# Job: Merge Back
# =====================================================
merge-back:
if: startsWith(github.ref, 'refs/heads/hotfix-') || startsWith(github.ref, 'refs/heads/release-')
needs:
- build
- docker
runs-on: ubuntu-latest
outputs:
runner_name: ${{ runner.name }}
steps:
- name: βœ… Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.VENLY_GITHUB_ACTIONS_TOKEN }}
- name: πŸ”„ Merge Back To Develop
id: merge_back
uses: ./.github/actions/merge_back
with:
branch: ${{ github.ref }}
token: ${{ secrets.VENLY_GITHUB_ACTIONS_TOKEN }}