-
Notifications
You must be signed in to change notification settings - Fork 1
121 lines (112 loc) · 6.35 KB
/
pipeline.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
name: AuthServer Build and deploy Pipeline
on:
push:
branches:
- "master"
jobs:
Build-Pipeline:
runs-on: ubuntu-latest
environment: production
steps:
- name: code checkout
uses: actions/checkout@v3
- 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: "Docker Build and Push"
env:
GOOGLE_PROJECT_ID: ${{secrets.GOOGLE_PROJECT_ID}}
GOOGLE_ARTIFACT_URL: ${{secrets.GOOGLE_ARTIFACT_URL}}
GOOGLE_ARTIFACT_REPO: ${{secrets.GOOGLE_ARTIFACT_REPO}}
HYPERSIGN_JSON: ${{secrets.HYPERSIGN_JSON}}
run:
docker build -t $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/auth-server:latest .
docker push $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/auth-server:latest
docker build -t $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/auth-server-txn:latest . -f Txn.Dockerfile
docker push $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/auth-server-txn:latest
Deploy-Pipeline:
needs: [Build-Pipeline]
runs-on: ubuntu-latest
environment: production
steps:
- name: code checkout
uses: actions/checkout@v3
- 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 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: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__EDV_BASE_URL__#${{ secrets.EDV_BASE_URL }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__NODE_ENV__#${{ secrets.NODE_ENV }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__HOST__#${{ secrets.HOST }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__PORT__#${{ secrets.PORT }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__LOG_LEVEL__#${{ secrets.LOG_LEVEL }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__DATA_DIR__#${{ secrets.DATA_DIR }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__DB_INMEM__#${{ secrets.DB_INMEM }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__SERVICE_END_POINT__#${{ secrets.SERVICE_END_POINT }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__HIDNODE_RPC_URL__#${{ secrets.HIDNODE_RPC_URL }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__HIDNODE_REST_URL__#${{ secrets.HIDNODE_REST_URL }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__EDV_BASE_URL__#${{ secrets.EDV_BASE_URL }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__EDV_ID__#${{ secrets.EDV_ID }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__MAX_BATCH_SIZE__#${{ secrets.MAX_BATCH_SIZE }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__DB_URL__#${{ secrets.DB_URL }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__MINIMUM_DELAY__#${{ secrets.MINIMUM_DELAY }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__MAXIMUM_DELAY__#${{ secrets.MAXIMUM_DELAY }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__EDV_CONFIG_DIR__#${{ secrets.EDV_CONFIG_DIR }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__EDV_DID_FILE_PATH__#${{ secrets.EDV_DID_FILE_PATH }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__EDV_KEY_FILE_PATH__#${{ secrets.EDV_KEY_FILE_PATH }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__REDIS_HOST__#${{ secrets.REDIS_HOST }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__REDIS_PORT__#${{ secrets.REDIS_PORT }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__HID_WALLET_MNEMONIC__#${{ secrets.HID_WALLET_MNEMONIC }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__AUTH0TENANT__#${{ secrets.AUTH0TENANT }}#" {} \;
- name: "Deploy to GKE"
run: kubectl apply -f .deploy/deployment.yaml