-
Notifications
You must be signed in to change notification settings - Fork 6
178 lines (156 loc) · 9.58 KB
/
deploy.yml
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Deploy verifier backend to AWS Environment
on:
workflow_run:
workflows: ["Checks"]
branches: ["develop", "main"]
types:
- completed
env:
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
ECR_REPOSITORY: verifier_backend
POLYGON_AMOY_CONTRACT_ADDRESS: "0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124"
POLYGON_AMOY_SENDER_DID: "did:iden3:polygon:amoy:xCkXubP2T1zsUQpFLwczwfbWpdBYBxmJDtUTWAUCE"
POLYGON_AMOY_CHAIN_ID: "80002"
POLYGON_MAIN_CONTRACT_ADDRESS: "0x624ce98D2d27b20b8f8d521723Df8fC4db71D79D"
POLYGON_MAIN_SENDER_DID: "did:polygonid:polygon:main:2q4Q7F7tM1xpwUTgWivb6TgKX3vWirsE3mqymuYjVv"
POLYGON_MAIN_CHAIN_ID: "137"
POLYGON_ZKEVM_MAIN_CONTRACT_ADDRESS: "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896"
POLYGON_ZKEVM_MAIN_SENDER_DID: "did:iden3:polygon:zkevm:xJa94Ky3oeawnDdQVoTotncYnBA1fCLW6C4NZVpRu"
POLYGON_ZKEVM_MAIN_CHAIN_ID: "1101"
POLYGON_ZKEVM_CARDONA_CONTRACT_ADDRESS: "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896"
POLYGON_ZKEVM_CARDONA_SENDER_DID: "did:iden3:polygon:cardona:xWCCEr5ycUDRWQp3Zu6UJvyUuGsEUpwfenMQXixEj"
POLYGON_ZKEVM_CARDONA_CHAIN_ID: "2442"
PRIVADO_MAIN_CONTRACT_ADDRESS: "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896"
PRIVADO_MAIN_SENDER_DID: "did:iden3:privado:main:2SZz8Kvfb6CXGTiiqNiz8CTFTnySV7PKN7iVUvsNMH"
PRIVADO_MAIN_CHAIN_ID: "21000"
PRIVADO_TEST_CONTRACT_ADDRESS: "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896"
PRIVADO_TEST_SENDER_DID: "did:iden3:privado:test:2Sn9bnRFiTYNfbS1dVTaGCUXuMfnQMUcTCAXtFv4Gr"
PRIVADO_TEST_CHAIN_ID: "21001"
LINEA_SEPOLIA_CONTRACT_ADDRESS: "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896"
LINEA_SEPOLIA_SENDER_DID: "did:iden3:linea:sepolia:28itzVLBHnMJV8sdjyffcAtWCx8HZ7btdKXxs7fJ6v"
LINEA_SEPOLIA_CHAIN_ID: "59141"
LINEA_SEPOLIA_METHOD: "iden3"
LINEA_MAIN_CONTRACT_ADDRESS: "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896"
LINEA_MAIN_SENDER_DID: "did:iden3:linea:main:28vX3frJDbAvHLSMHEwxuxRk1GPpjBeUEsXdAwVxDm"
LINEA_MAIN_CHAIN_ID: "59144"
LINEA_MAIN_METHOD: "iden3"
ETHEREUM_SEPOLIA_CONTRACT_ADDRESS: "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896"
ETHEREUM_SEPOLIA_SENDER_DID: "did:iden3:eth:sepolia:21Jtxn7kxuy27h7NzZFwk8x2YcepKyfRyX4Tt6tqYK"
ETHEREUM_SEPOLIA_NODE_URL: "https://rpc.sepolia.org"
ETHEREUM_SEPOLIA_CHAIN_ID: "11155111"
ETHEREUM_SEPOLIA_METHOD: "iden3"
ETHEREUM_MAIN_CONTRACT_ADDRESS: "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896"
ETHEREUM_MAIN_SENDER_DID: "did:iden3:eth:main:zuerR5X7JKmAEj1iR4gRJfJgNTPtLQDePsspASZvf"
ETHEREUM_MAIN_NODE_URL: "https://eth-mainnet.g.alchemy.com/v2/demo"
ETHEREUM_MAIN_CHAIN_ID: "1"
ETHEREUM_MAIN_METHOD: "iden3"
jobs:
build-backend:
environment:
name: ${{ github.event.workflow_run.head_branch }}
name: Build and push latest image to AWS
permissions:
id-token: write
contents: write
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.20"
- uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Print Environment
run: echo ${{ github.event.workflow_run.head_branch }}
- name: Build file with supported networks
run: |
echo -e "polygon:" > resolvers_settings.yaml
echo -e " amoy:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.POLYGON_AMOY_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.POLYGON_AMOY_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.POLYGON_AMOY_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.POLYGON_AMOY_SENDER_DID }}" >> resolvers_settings.yaml
echo -e " main:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.POLYGON_MAIN_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.POLYGON_MAINET_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.POLYGON_MAIN_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.POLYGON_MAIN_SENDER_DID }}" >> resolvers_settings.yaml
echo -e " zkevm:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.POLYGON_ZKEVM_MAIN_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.POLYGON_ZKEVM_MAIN_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.POLYGON_ZKEVM_MAIN_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.POLYGON_ZKEVM_MAIN_SENDER_DID }}" >> resolvers_settings.yaml
echo -e " cardona:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.POLYGON_ZKEVM_CARDONA_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.POLYGON_ZKEVM_CARDONA_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.POLYGON_ZKEVM_CARDONA_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.POLYGON_ZKEVM_CARDONA_SENDER_DID }}" >> resolvers_settings.yaml
echo -e "linea:" >> resolvers_settings.yaml
echo -e " sepolia:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.LINEA_SEPOLIA_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.LINEA_SEPOLIA_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.LINEA_SEPOLIA_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.LINEA_SEPOLIA_SENDER_DID }}" >> resolvers_settings.yaml
echo -e " method: ${{ env.LINEA_SEPOLIA_METHOD }}" >> resolvers_settings.yaml
echo -e " main:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.LINEA_MAIN_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.LINEA_MAIN_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.LINEA_MAIN_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.LINEA_MAIN_SENDER_DID }}" >> resolvers_settings.yaml
echo -e " method: ${{ env.LINEA_MAIN_METHOD }}" >> resolvers_settings.yaml
echo -e "privado:" >> resolvers_settings.yaml
echo -e " test:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.PRIVADO_TEST_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.PRIVADO_TEST_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.PRIVADO_TEST_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.PRIVADO_TEST_SENDER_DID }}" >> resolvers_settings.yaml
echo -e " main:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.PRIVADO_MAIN_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.PRIVADO_MAINET_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.PRIVADO_MAIN_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.PRIVADO_MAIN_SENDER_DID }}" >> resolvers_settings.yaml
echo -e "ethereum:" >> resolvers_settings.yaml
echo -e " sepolia:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.ETHEREUM_SEPOLIA_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.ETHEREUM_SEPOLIA_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.ETHEREUM_SEPOLIA_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.ETHEREUM_SEPOLIA_SENDER_DID }}" >> resolvers_settings.yaml
echo -e " main:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.ETHEREUM_MAIN_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.ETHEREUM_MAIN_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.ETHEREUM_MAIN_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.ETHEREUM_MAIN_SENDER_DID }}" >> resolvers_settings.yaml
cat resolvers_settings.yaml
- run: make build/docker
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1-node16
env:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID_NEW }}
with:
aws-region: ${{ env.AWS_DEFAULT_REGION }}
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/PolygonIDActionsRole
role-session-name: GitHubActionsSession
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v1
id: login-ecr
- name: Get version
run: echo "::set-output name=VERSION::$(git rev-parse --short HEAD)"
id: version
- name: Tag and push image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }}
IMAGE_TAG: ${{ steps.version.outputs.VERSION }}
run: |
docker tag polygonid/verifier-backend:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
docker tag polygonid/verifier-backend:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest
docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest