-
Notifications
You must be signed in to change notification settings - Fork 3
137 lines (117 loc) · 4.94 KB
/
front_app_deploy_script.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Update Frontend From Release - from script
on:
repository_dispatch:
types: ["trigger-event"]
env:
GIT-REF: ${{ github.event.client_payload.git-ref }}
jobs:
init:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
ref: ${{ github.event.client_payload.git-ref }}
- name: (GLOBAL) Debug - Deploy ${{ github.event.client_payload.git-ref }} on ${{ github.event.client_payload.Environment }}
run: |
ls -la
echo "${{github.ref}}"
echo "${{ github.sha }}"
echo "Opened: ${{github.event.pull_request.opened}}"
echo "Assigned: ${{github.event.pull_request.assigned}}"
echo "Review: ${{github.event.pull_request.ready_for_review}}"
echo "Review_Requested: ${{github.event.pull_request.review_requested}}"
echo "Release Body: ${{github.event.release.body}}"
- name: (GLOBAL) Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
# Qa Assume role
- name: (QA) Assume role
uses: aws-actions/configure-aws-credentials@v1
if: contains(github.event.client_payload.Environment, 'Qa')
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
role-to-assume: arn:aws:iam::${{ secrets.QA_AWS_ACCOUNT }}:role/Devops-Role
role-duration-seconds: 3600
role-session-name: GithubActions-Qa
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '12.7'
- run: npm install
- run: npm run build
- run: ls -la dist/modfi-app
#- name: Yarn Install
#run: |
#yarn install
#- name: Dev Build
#run: |
#yarn build
#- name: Unit Tests
#run: |
#yarn test
- name: Give permissions
run: |
chmod +x scripts/*.sh
- name: Disable Caching and Deploy to the failover s3 bucket
if: contains(github.event.client_payload.Environment, 'Qa')
run: ./scripts/before_cloudfront.sh
- name: Running test
if: contains(github.event.client_payload.Environment, 'Qa')
run: |
sleep 600
- name: After the tests enable Caching and replication
if: contains(github.event.client_payload.Environment, 'Qa') && failure()
run: ./scripts/after_cloudfront.sh failure
- name: After the tests enable Caching and Switch the Buckets on Origin Group
if: contains(github.event.client_payload.Environment, 'Qa')
run: ./scripts/after_cloudfront.sh success
# Prod Assume role
- name: (PROD) Assume role
uses: aws-actions/configure-aws-credentials@v1
if: contains(github.event.client_payload.Environment, 'Prod')
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
role-to-assume: arn:aws:iam::${{ secrets.PROD_AWS_ACCOUNT }}:role/Devops-Role
role-duration-seconds: 3600
role-session-name: GithubActions-Prod
- name: Disable Caching and Deploy to the failover s3 bucket
if: contains(github.event.client_payload.Environment, 'Prod')
run: ./scripts/before_cloudfront.sh
- name: Running test
if: contains(github.event.client_payload.Environment, 'Prod')
run: |
sleep 600
- name: After the tests enable Caching and replication
if: contains(github.event.client_payload.Environment, 'Prod') && failure()
run: ./scripts/after_cloudfront.sh failure
- name: After the tests enable Caching and Switch the Buckets on Origin Group
if: contains(github.event.client_payload.Environment, 'Prod')
run: ./scripts/after_cloudfront.sh success
- name: Slack Notification
if: contains(github.event.client_payload.Environment, 'Qa')
uses: rtCamp/action-slack-notify@master
env:
SLACK_CHANNEL: system_alerts_qa
SLACK_COLOR: '#3278BD'
SLACK_MESSAGE: '${{github.event.release.body}} Status: OK'
SLACK_TITLE: Information
SLACK_USERNAME: Github-CICD
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_QA }}
- name: Slack Notification Prod
if: contains(github.event.client_payload.Environment, 'Prod')
uses: rtCamp/action-slack-notify@master
env:
SLACK_CHANNEL: system_alerts_prod
SLACK_COLOR: '#3278BD'
SLACK_MESSAGE: '${{github.event.release.body}} Status: OK'
SLACK_TITLE: Information
SLACK_USERNAME: Github-CICD
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_PROD }}