-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dev 336/amplify webhook builds (#2906)
* 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
1 parent
f276e5c
commit 130b240
Showing
3 changed files
with
246 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |