Skip to content

Commit

Permalink
Dev 336/amplify webhook builds (#2906)
Browse files Browse the repository at this point in the history
* feat: added new actions to build front-end apps manually

* fix: fixed a typo

* fix: changed the action names for the new front-end build actions

* feat: added on-failuew job to notify when the job fails

* fix: added changes code rabbit

* fix: removed redundant step for build action

* chore: removing on push trigger on the actions
  • Loading branch information
codechirag123 authored Feb 10, 2025
1 parent f276e5c commit 130b240
Show file tree
Hide file tree
Showing 3 changed files with 246 additions and 0 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/deploy-backoffice.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Under Testing - Build and Deploy Backoffice Application

on:
# push:
# paths:
# # Run this pipeline only if there are changes in specified path
# - 'apps/backoffice-v2/**'
# branches:
# - "dev"
workflow_dispatch:
inputs:
environment:
type: choice
description: 'Choose Environment'
required: true
default: 'dev'
options:
- 'dev'
- 'sb'
- 'prod'
workflow_call:
inputs:
environment:
type: string
description: 'Environment'
required: true
default: 'dev'

jobs:
build:
name: Build Backoffice App
runs-on: ubuntu-latest
environment: ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}
steps:
# Trigger a webhook
- name: Trigger Build webhook
run: |
# curl -X POST -d {} "${{ secrets.BACKOFFICE_WEBHOOK_URL }}" -H "Content-Type:application/json"
response=$(curl -s -w "\n%{http_code}" -X POST -d {} "${{ secrets.BACKOFFICE_WEBHOOK_URL }}" -H "Content-Type:application/json")
status_code=$(echo "$response" | tail -n 1)
if [ "$status_code" -lt 200 ] || [ "$status_code" -ge 300 ]; then
echo "Error: Webhook request failed with status $status_code"
echo "Response: $(echo "$response" | head -n -1)"
exit 1
fi
send-to-slack:
runs-on: ubuntu-latest
needs: [build]
if: ${{ needs.build.result == 'success' }}
environment: ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}
permissions:
contents: read
packages: write

steps:
- name: Send alert to Slack channel
id: slack
uses: slackapi/slack-github-action@v1.26.0
with:
channel-id: '${{ secrets.ARGO_SLACK_CHANNEL_ID }}'
slack-message: "Back-office Build initialized in ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}."
env:
SLACK_BOT_TOKEN: ${{ secrets.ARGO_SLACK_BOT_TOKEN }}

on-failure:
runs-on: ubuntu-latest
needs: [build]
if: failure()
environment: ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}
permissions:
contents: read
packages: write
steps:
- name: Send alert to Slack channel
id: slack
uses: slackapi/slack-github-action@v1.26.0
with:
channel-id: '${{ secrets.ARGO_SLACK_CHANNEL_ID }}'
slack-message: "Backoffice Build job failed in ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}."
env:
SLACK_BOT_TOKEN: ${{ secrets.ARGO_SLACK_BOT_TOKEN }}
82 changes: 82 additions & 0 deletions .github/workflows/deploy-dashboard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Under Testing - Build and Deploy Dashboard Application

on:
# push:
# paths:
# # Run this pipeline only if there are changes in specified path
# - 'apps/workflows-dashboard/**'
# branches:
# - "dev"
workflow_dispatch:
inputs:
environment:
type: choice
description: 'Choose Environment'
required: true
default: 'dev'
options:
- 'dev'
- 'sb'
- 'prod'
workflow_call:
inputs:
environment:
type: string
description: 'Environment'
required: true
default: 'dev'

jobs:
build:
name: Build Dashboard App
runs-on: ubuntu-latest
environment: ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}
steps:
# Trigger a webhook
- name: Trigger Build webhook
run: |
# curl -X POST -d {} "${{ secrets.DASHBOARD_WEBHOOK_URL }}" -H "Content-Type:application/json"
response=$(curl -s -w "\n%{http_code}" -X POST -d {} "${{ secrets.DASHBOARD_WEBHOOK_URL }}" -H "Content-Type:application/json")
status_code=$(echo "$response" | tail -n 1)
if [ "$status_code" -lt 200 ] || [ "$status_code" -ge 300 ]; then
echo "Error: Webhook request failed with status $status_code"
echo "Response: $(echo "$response" | head -n -1)"
exit 1
fi
send-to-slack:
runs-on: ubuntu-latest
needs: [build]
if: ${{ needs.build.result == 'success' }}
environment: ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}
permissions:
contents: read
packages: write

steps:
- name: Send alert to Slack channel
id: slack
uses: slackapi/slack-github-action@v1.26.0
with:
channel-id: '${{ secrets.ARGO_SLACK_CHANNEL_ID }}'
slack-message: "Dashboard Build initialized in ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}."
env:
SLACK_BOT_TOKEN: ${{ secrets.ARGO_SLACK_BOT_TOKEN }}

on-failure:
runs-on: ubuntu-latest
needs: [build]
if: failure()
environment: ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}
permissions:
contents: read
packages: write
steps:
- name: Send alert to Slack channel
id: slack
uses: slackapi/slack-github-action@v1.26.0
with:
channel-id: '${{ secrets.ARGO_SLACK_CHANNEL_ID }}'
slack-message: "Dashboard Build job failed in ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}."
env:
SLACK_BOT_TOKEN: ${{ secrets.ARGO_SLACK_BOT_TOKEN }}
82 changes: 82 additions & 0 deletions .github/workflows/deploy-kyb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Under Testing - Build and Deploy KYB Application

on:
# push:
# paths:
# # Run this pipeline only if there are changes in specified path
# - 'apps/kyb-app/**'
# branches:
# - "dev"
workflow_dispatch:
inputs:
environment:
type: choice
description: 'Choose Environment'
required: true
default: 'dev'
options:
- 'dev'
- 'sb'
- 'prod'
workflow_call:
inputs:
environment:
type: string
description: 'Environment'
required: true
default: 'dev'

jobs:
build:
name: Build KYB App
runs-on: ubuntu-latest
environment: ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}
steps:
# Trigger a webhook
- name: Trigger Build webhook
run: |
# curl -X POST -d {} "${{ secrets.KYB_WEBHOOK_URL }}" -H "Content-Type:application/json"
response=$(curl -s -w "\n%{http_code}" -X POST -d {} "${{ secrets.KYB_WEBHOOK_URL }}" -H "Content-Type:application/json")
status_code=$(echo "$response" | tail -n 1)
if [ "$status_code" -lt 200 ] || [ "$status_code" -ge 300 ]; then
echo "Error: Webhook request failed with status $status_code"
echo "Response: $(echo "$response" | head -n -1)"
exit 1
fi
send-to-slack:
runs-on: ubuntu-latest
needs: [build]
if: ${{ needs.build.result == 'success' }}
environment: ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}
permissions:
contents: read
packages: write

steps:
- name: Send alert to Slack channel
id: slack
uses: slackapi/slack-github-action@v1.26.0
with:
channel-id: '${{ secrets.ARGO_SLACK_CHANNEL_ID }}'
slack-message: "KYB Build initialized in ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}."
env:
SLACK_BOT_TOKEN: ${{ secrets.ARGO_SLACK_BOT_TOKEN }}

on-failure:
runs-on: ubuntu-latest
needs: [build]
if: failure()
environment: ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}
permissions:
contents: read
packages: write
steps:
- name: Send alert to Slack channel
id: slack
uses: slackapi/slack-github-action@v1.26.0
with:
channel-id: '${{ secrets.ARGO_SLACK_CHANNEL_ID }}'
slack-message: "KYB Build job failed in ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}."
env:
SLACK_BOT_TOKEN: ${{ secrets.ARGO_SLACK_BOT_TOKEN }}

0 comments on commit 130b240

Please sign in to comment.