-
Notifications
You must be signed in to change notification settings - Fork 2
164 lines (134 loc) · 7.97 KB
/
CI-CD.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Fyre UI Build and Deploy Pipeline
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]-rc.[0-9]+"
jobs:
Build-Pipeline:
runs-on: ubuntu-latest
environment: production
steps:
- name: code checkout
uses: actions/checkout@v3
- name: Set Latest Tag
run: echo "LATEST_RELEASE_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- id: "auth"
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}"
- name: install gcloud cli tools
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.GOOGLE_PROJECT_ID }}
service_account_key: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
install_components: "gke-gcloud-auth-plugin"
export_default_credentials: true
- name: "Use gcloud CLI"
run: "gcloud info"
- name: "Docker Auth"
run: gcloud auth configure-docker ${{ secrets.GOOGLE_ARTIFACT_URL }}
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__NODE_ENV__#${{ vars.NODE_ENV }}#" {} \;
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__VUE_APP_AUTH0_CLIENT_ID__#${{ vars.VUE_APP_AUTH0_CLIENT_ID }}#" {} \;
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__VUE_APP_AUTH0_DOMAIN__#${{ vars.VUE_APP_AUTH0_DOMAIN }}#" {} \;
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__VUE_APP_MOBILEWALLET_URL__#${{ vars.VUE_APP_MOBILEWALLET_URL }}#" {} \;
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__VUE_APP_RECAPTCHA_SITE_KEY__#${{ vars.VUE_APP_RECAPTCHA_SITE_KEY }}#" {} \;
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__VUE_APP_SERVER_WEBSOCKET_URL__#${{ vars.VUE_APP_SERVER_WEBSOCKET_URL }}#" {} \;
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__VUE_APP_TITLE__#${{ vars.VUE_APP_TITLE }}#" {} \;
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__VUE_APP_VERSION__#${{ vars.VUE_APP_VERSION }}#" {} \;
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__VUE_APP_WEBWALLET_URL__#${{ vars.VUE_APP_WEBWALLET_URL }}#" {} \;
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__VUE_APP_GA_CODE__#${{ vars.VUE_APP_GA_CODE }}#" {} \;
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__VUE_APP_KOMMINICATE_APP_ID__#${{ vars.VUE_APP_KOMMINICATE_APP_ID }}#" {} \;
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__VUE_APP_WEBPUSH_VAPID_PUBLIC_KEY__#${{ vars.VUE_APP_WEBPUSH_VAPID_PUBLIC_KEY }}#" {} \;
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__VUE_APP_INVESTOR_API_SECRET_KEY__#${{ vars.VUE_APP_INVESTOR_API_SECRET_KEY }}#" {} \;
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__VUE_APP_BTN_BACKGROUND__#${{ vars.VUE_APP_BTN_BACKGROUND }}#" {} \;
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__VUE_APP_HEADER_BACKGROUND__#${{ vars.VUE_APP_HEADER_BACKGROUND }}#" {} \;
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__VUE_APP_HEADER_TEXT_COLOR__#${{ vars.VUE_APP_HEADER_TEXT_COLOR }}#" {} \;
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__VUE_APP_THEME_BACKGROUND__#${{ vars.VUE_APP_THEME_BACKGROUND }}#" {} \;
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__VUE_APP_MOOPAY_PAYMENT_URL__#${{ vars.VUE_APP_MOOPAY_PAYMENT_URL }}#" {} \;
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__VUE_APP_FYRE_WALLET_ADDRESS__#${{ vars.VUE_APP_FYRE_WALLET_ADDRESS }}#" {} \;
- name: Replace Secrets
run: find Dockerfile -type f -exec sed -i -e "s#__VUE_APP_AUTH0_LOGIN_CLIENT_ID__#${{ vars.VUE_APP_AUTH0_LOGIN_CLIENT_ID }}#" {} \;
- name: "Docker Build and Push"
env:
NODE_ENV: ${{ vars.NODE_ENV }}
VUE_APP_AUTH0_CLIENT_ID: ${{ vars.VUE_APP_AUTH0_CLIENT_ID }}
VUE_APP_AUTH0_DOMAIN: ${{ vars.VUE_APP_AUTH0_DOMAIN }}
VUE_APP_MOBILEWALLET_URL: ${{ vars.VUE_APP_MOBILEWALLET_URL }}
VUE_APP_RECAPTCHA_SITE_KEY: ${{ vars.VUE_APP_RECAPTCHA_SITE_KEY }}
VUE_APP_SERVER_WEBSOCKET_URL: ${{ vars.VUE_APP_SERVER_WEBSOCKET_URL }}
VUE_APP_STUDIO_SERVER_BASE_URL: ${{ vars.VUE_APP_STUDIO_SERVER_BASE_URL }}
VUE_APP_TELEGRAM_BOT_ID: ${{ vars.VUE_APP_TELEGRAM_BOT_ID }}
VUE_APP_TELEGRAM_VERIFIER_BOT: ${{ vars.VUE_APP_TELEGRAM_VERIFIER_BOT }}
VUE_APP_TITLE: ${{ vars.VUE_APP_TITLE }}
VUE_APP_VERSION: ${{ vars.VUE_APP_VERSION }}
VUE_APP_WEBWALLET_URL: ${{ vars.VUE_APP_WEBWALLET_URL }}
VUE_APP_GA_CODE: ${{ vars.VUE_APP_GA_CODE }}
VUE_APP_KOMMINICATE_APP_ID: ${{ vars.VUE_APP_KOMMINICATE_APP_ID }}
VUE_APP_WEBPUSH_VAPID_PUBLIC_KEY: ${{ vars.VUE_APP_WEBPUSH_VAPID_PUBLIC_KEY }}
VUE_APP_INVESTOR_API_SECRET_KEY: ${{ vars.VUE_APP_INVESTOR_API_SECRET_KEY }}
VUE_APP_BTN_BACKGROUND: ${{ vars.VUE_APP_BTN_BACKGROUND }}
VUE_APP_BTN_TXT_COLOR: ${{ vars.VUE_APP_BTN_TXT_COLOR }}
VUE_APP_HEADER_BACKGROUND: ${{ vars.VUE_APP_HEADER_BACKGROUND }}
VUE_APP_HEADER_TEXT_COLOR: ${{ vars.VUE_APP_HEADER_TEXT_COLOR }}
VUE_APP_THEME_BACKGROUND: ${{ vars.VUE_APP_THEME_BACKGROUND }}
VUE_APP_MOOPAY_PAYMENT_URL: ${{ vars.VUE_APP_MOOPAY_PAYMENT_URL }}
VUE_APP_FYRE_WALLET_ADDRESS: ${{ vars.VUE_APP_FYRE_WALLET_ADDRESS }}
VUE_APP_AUTH0_LOGIN_CLIENT_ID: ${{ vars.VUE_APP_AUTH0_LOGIN_CLIENT_ID }}
GOOGLE_PROJECT_ID: ${{secrets.GOOGLE_PROJECT_ID}}
GOOGLE_ARTIFACT_URL: ${{secrets.GOOGLE_ARTIFACT_URL}}
GOOGLE_ARTIFACT_REPO: ${{secrets.GOOGLE_ARTIFACT_REPO}}
run:
docker build -t $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/fyre-frontend:${{ env.LATEST_RELEASE_TAG }} .
docker push $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/fyre-frontend:${{ env.LATEST_RELEASE_TAG }}
Deploy-Pipeline:
needs: [Build-Pipeline]
runs-on: ubuntu-latest
environment: production
steps:
- name: code checkout
uses: actions/checkout@v3
- name: Set Latest Tag
run: echo "LATEST_RELEASE_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- id: "auth"
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}"
- name: install gcloud cli tools
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{secrets.GOOGLE_PROJECT_ID}}
service_account_key: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS}}
install_components: "gke-gcloud-auth-plugin"
export_default_credentials: true
- name: "Configure kubectl"
run: gcloud container clusters get-credentials hypermine-gke --region=asia-south1
- name: Replace tags
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__LATEST_RELEASE_TAG__#${{ env.LATEST_RELEASE_TAG }}#" {} \;
- name: "Replace secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i ''s/__GOOGLE_ARTIFACT_URL__/${{ secrets.GOOGLE_ARTIFACT_URL }}/g'' {} \;
- name: "Replace secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i ''s/__GOOGLE_ARTIFACT_REPO__/${{ secrets.GOOGLE_ARTIFACT_REPO }}/g'' {} \;
- name: "Replace secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i ''s/__GOOGLE_PROJECT_ID__/${{ secrets.GOOGLE_PROJECT_ID }}/g'' {} \;
- name: "Deploy to GKE"
run: kubectl apply -f .deploy/deployment.yaml