Skip to content

Manual Deployment to PROD From Main. #38

Manual Deployment to PROD From Main.

Manual Deployment to PROD From Main. #38

name: Manual Deployment to PROD From Main.
#This workflow will just tag docker image from test to the tag number and deploy it to PROD.
on:
workflow_dispatch:
inputs:
RELEASE_VERSION:
required: true
description: The Tag release to PROD. #test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
builds:
name: Builds
uses: ./.github/workflows/_build.yml
strategy:
matrix:
component: [backend/applications, backend/gateway, backend/legacy, backend/users, frontend]
include:
- component: backend/applications
triggers: ('backend/applications/')
- component: backend/gateway
triggers: ('backend/gateway/')
- component: backend/legacy
triggers: ('backend/legacy/')
- component: backend/users
triggers: ('backend/users/')
- component: frontend
triggers: ('frontend/')
secrets:
gh_token: ${{ secrets.GITHUB_TOKEN }}
with:
component: ${{ matrix.component }}
img_build: ${{ inputs.RELEASE_VERSION }}
img_fallback: "test" # The test image will be tagged with prod release version as in input.
triggers: ${{ matrix.triggers }}
deploys:
name: Deploys
needs:
- builds
# If any of the previous created a build, then deploy
# if: contains(needs.*.outputs.build, 'true')
uses: ./.github/workflows/_deploy.yml
strategy:
matrix:
component: [backend/applications, backend/gateway, backend/legacy, backend/users, database, frontend]
include:
- component: database
overwrite: false
template_file: .github/openshift/deploy.database.yml
template_vars: -p DB_PVC_SIZE=200Mi
- component: backend/applications
overwrite: true
template_file: .github/openshift/deploy.backend-applications.yml
template_vars: -p PROMOTE=${{ github.repository }}/backend/applications -p CONTAINER_PORT=4006 -p ENV=prod -p IMAGE_TAG=${{ inputs.RELEASE_VERSION }} -p MIN_REPLICAS=3 -p MAX_REPLICAS=6
- component: backend/gateway
overwrite: true
template_file: .github/openshift/deploy.backend-gateway.yml
template_vars: -p PROMOTE=${{ github.repository }}/backend/gateway -p CONTAINER_PORT=4010 -p ENV=prod -p IMAGE_TAG=${{ inputs.RELEASE_VERSION }} -p MIN_REPLICAS=3 -p MAX_REPLICAS=6
- component: backend/legacy
overwrite: true
template_file: .github/openshift/deploy.backend-legacy.yml
template_vars: -p PROMOTE=${{ github.repository }}/backend/legacy -p CONTAINER_PORT=4011 -p ENV=prod -p IMAGE_TAG=${{ inputs.RELEASE_VERSION }} -p MIN_REPLICAS=3 -p MAX_REPLICAS=6
- component: backend/users
overwrite: true
template_file: .github/openshift/deploy.backend-users.yml
template_vars: -p PROMOTE=${{ github.repository }}/backend/users -p CONTAINER_PORT=4005 -p ENV=prod -p IMAGE_TAG=${{ inputs.RELEASE_VERSION }} -p MIN_REPLICAS=3 -p MAX_REPLICAS=6
- component: frontend
overwrite: true
template_file: .github/openshift/deploy.frontend.yml
template_vars: -p PROMOTE=${{ github.repository }}/frontend -p CONTAINER_PORT=8080 -p ENV=prod -p IMAGE_TAG=${{ inputs.RELEASE_VERSION }} -p MIN_REPLICAS=3 -p MAX_REPLICAS=6
secrets:
oc_namespace: ${{ secrets.OC_NAMESPACE }}
oc_server: ${{ secrets.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
with:
environment: prod
component: ${{ matrix.component }}
overwrite: ${{ matrix.overwrite }}
template_file: ${{ matrix.template_file }}
template_vars: ${{ matrix.template_vars }}
tag:
name: Create The Production Release Tag
runs-on: ubuntu-22.04
environment: prod
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: release/${{ inputs.RELEASE_VERSION }}
release_name: Release release/${{ inputs.RELEASE_VERSION }}
body: |
Changes in this Release
- Test release notes
draft: false
prerelease: false
# steps:
# - uses: rickstaa/action-create-tag@v1
# name: Create Release Tag in Git
# with:
# tag: "release/${{ inputs.RELEASE_VERSION }}"
# message: "Release version ${{ inputs.RELEASE_VERSION }}"